Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I tried tesseract but it only works on pure text document, can anyone suggest me what to do?
Here is my code for vb.net
Dim pic = New Bitmap(OpenFileDialog1.FileName)
Dim ocr = New TesseractEngine("./dataset", "eng", EngineMode.TesseractAndCube)
Dim page = ocr.Process(pic)
TextBox1.Text = page.GetText
It looks like your answer sheet is well structured. I would focus on extracting a sub-image for each answer, and then running Tesseract in single character mode on that image.
I'm not sure how you get single character mode in whatever Tesseract wrapper you're using, but via command line it's the parameter: --psm 10.
To extract each image, I would use OpenCV (try Emgu for .NET). You may need to first apply a perspective wrap in order to get the image square. You can then use a simple sliding window to get each sub image.
I'm not sure how this will perform in cases where an answer has been crossed out.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have an Application build in WPF. It have a Textbox that will always accept only 10 digits and is always ready for Scanning ID Barcode Contains 10 Digits or Entering Number with Keyboard.
Now some Customers are entering just 2 digits and leaving system as it is. Let us say he write 12 in TextBox and left it. When new Customer is coming he is Scanning his Id without noticing that there is something already written in the TextBox. So New Number is coming like this 1224444444 and two numbers are missing that is 34.
How can I clear Textbox before Scanning or Before Writing?
some example code of exactly how you are attempting this would be useful.
A WPF textbox can be cleared by either calling the .Clear method, or simply by setting the "Text" property of the Textbox to string.empty.
With regards to most barcode scanners i've seen and used (usually KB emulation), you can usually set them up to get a prefix and suffix on the data so that you can detect scan input over keyboard input. You can then detect a scan and clear the textbox prior to entering the new information
react at the new scanevent from the barcodescanner and clear the textbox.text with string.empty
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a simple question (I hope it is simple for someone). How could I recognize is .tif (or .tiff) image contains two or more pages, or it is just one image (one "page"). I use .NET. For what? I have an image as input and should process it in some way, and if image consists of several images - choose one method, just one image - another method. I am waiting for any free solution (it can be just .net or any free third-party library). I don't need to split tiff or any other good thing, just something like
Boolean isMultipage = SomeLibrary.IsTifMultipage(filePath);
Thanks!
You could write a method that would determine that for..Perhaps something like this?
public bool IsMultipage(string fileName)
{
using (Image imageFile = Image.FromFile(fileName))
{
FrameDimension frameDimensions = new FrameDimension(imageFile.FrameDimensionsList[0]);
return imageFile.GetFrameCount(frameDimensions) > 1;
}
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have used html5 camera capture attribute, when user try to capture image from the devices image gets rotated
Do we need to provide any setting on this?
Can we correct the image rotation using C#?
We are successfully using the following code to capture images and it works fine:
var canvas = document.getElementById("canvas")
var video = document.getElementById("video")
// Start video code omitted...
// Capture function
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext("2d").drawImage(video, 0, 0);
var imgData = canvas.toDataURL("image/jpeg")
The image should be fine unless there is some specific hardware configuration not allowing this.
And yes, it is possible to rotate the image using C#. Google it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a class library to add a customized toolbox to a external IE browser.
I'm using SHDocVw to do the back/forward buttons (e. g.). My question is, sense this is multilingual, how can I change the buttons text...
The url give me "/en/" or "/ar/", how can i catch this?
Thanks
With the Mati Cicero answer I managed to do it.
string page = ie.LocationURL;
Regex rgx = new Regex(#"https?://[a-zA-Z0-9.-_]+(/((?'lang'ar|en)|.*))/?");
var lang = rgx.Match(page).Success ? rgx.Match(page).Groups[1].Value : "ar";
You can try the following regex, I tried to make it as much generic as I could:
https?:\/\/[a-zA-Z0-9\.\-_]+(\/((?'lang'es|en)|.*))\/?
You would then examine the group "lang" to see if a match was made.
You would aso like to add more available languages (Added ch and in):
https?:\/\/[a-zA-Z0-9\.\-_]+(\/((?'lang'es|en|ch|in)|.*))\/?
If its always the first directory;
var lang = new Uri("http://sitename.com/en/pages/default.aspx")
.Segments[1].Replace("/", string.Empty).ToLower();
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Ok let me explain it again
My problem is
I want to display the image. But i want this without the opendialogfile
I tried this:
pictureBox1.Image = Image.FromFile("C:\\Users\\Abdullah\\Documents\\Visual Studio 2013\\Projects\\Maker\\Maker\\add.png");// it works
But i dont want to do this because it will cause errors at deployment time. What i want to do is:
pictureBox1.Image= Image.FromFile("add.png");// because this picture is already in the project folder
In this case it show me error that file not found
Now Hope so I explained it :)
Assuming that you are hard coding the path to your image and the image really exists in that path, then you should remember to escape the backslash when using a constant string like that one.
Try with
pictureBox1.ImageLocation = #"C:\Users\Abdullah\Documents\Visual Studio 2013
\Projects\Maker\Maker\Resources\add.png";
or
pictureBox1.ImageLocation = "C:\\Users\\Abdullah\\Documents\\Visual Studio 2013
\\Projects\\Maker\\Maker\\Resources\\add.png";
(Warning strings splitted in two lines for readability. It should be on one single line)
See How do I write a backslash?
EDIT:
Based on your comment below, then it seems that the Image folder always exists in your project (also when it will be deployed to a customer machine) then you could write something like this
pictureBox1.ImageLocation = Path.Combine(Application.StartupPath, "Images", "add.png");
or
string imageFile = Path.Combine(Application.StartupPath, "Images", "add.png");
pictureBox1.Image= Image.FromFile(imageFile);
But looking back to your example: Is it Images or Resources?