I have a picture of document taken from camera.
Now what i have to do is crop only document from that image .
Please can anyone suggest me how best it can be done or first is it possible or not
Edit
For more information .. my next question
How to get edge coordinates of a image?
If you know the area that contains the image data you would like to crop, you could use this article from MSDN:
http://msdn.microsoft.com/en-us/library/ms752345.aspx
If you need to find the relevant area before cropping, you need to investigate some image processing techniques. e.g. Corner Detection
In the assumption you are performing preprocessing for OCR, I would look into using the Aforge Framework if possible.
There is a specific set of functions in the Imaging classes for preforming crops and any other related manipulations(image rotation, hue adjustment, brightness/contrast adjustment, filter noise, etc) that you might need.
Two links for you
http://google.com/search?q=c%23+crop+bitmap and http://www.nerdydork.com/crop-an-image-bitmap-in-c-or-vbnet.html
Related
I am trying to implement my own monochrome/black and white filter in C# to scan text documents. My approach is to apply a threshold filter on the captured image. However, I often run into the problem that the varying brightness on the image causes a ''shadowing effect'' on the processed image. Refer to the link below (it is pretty blurry but it should suffice). The image to the far left is the original image. When I apply my threshold filter, I get the same result as the image in the middle; some of the text becomes unreadable because the brightness of the image varies, so some portions become really black or really white. However, with the right filter, you can obtain the processed image to the right where everything looks crystal clear.
https://www.google.dk/search?q=monochrome+image+processing&espv=2&biw=1706&bih=859&source=lnms&tbm=isch&sa=X&ved=0ahUKEwir8vXlhIzPAhUFiywKHeSBC1wQ_AUIBigB#imgrc=4UTzoIpyqTkwrM%3A
I would like to know what the process is to obtain the image to the far right. Another example can be seen in the image below. It shows a sample mobile PDF scanner in use. Scanning the image results in a very nice black and white image, where the text can be easily read and no ''shadowing'' occurs on the image. Does anyone know what this process is or what it is called? It is very often used in mobile PDF scanning applications. Thank you in advance.
EDIT: The filter is called ''Adaptive Thresholding''. You can use the BradleyLocalThresholding class to implement the filter, or you can write it yourself (which is what I did). Please refer to my response to the comment by Yves Daoust down below.
You need two ingredients.
One is "background reconstruction", i.e. retrieving the intensity of the white sheet "under the characters", for instance by morphological opening.
The other is "shading correction", i.e. compensating the unevenness of the background illumination by comparing to the reconstructed background, for instance by subtraction.
This will "flatten" the image, making it perfectly amenable to global thresholding.
A simple method is to convert the image to grayscale and then convert it to B/W using an error diffusion algorithm such as Floyd–Steinberg dithering.
I would like the system to pin point/highlight the deformed area to the user during video rendering. Lets say currently I have an image with a list of squares as shown in the image below, this is the original image without defects.
In the following image, is the sample image that consist of a defect, whereby there is an extra line in between the squares.
I would like to have something as shown in the sample image below where by it will have a red square to highlight the "extra line" to inform the user that there is a defect and will pin point the defect to the user.
The defects may appear in any kinds of shapes or forms, and I would like to pin point the defects to the user. So what kind of algorithm I should use in order to achieve this?
Also, is machine learning required in order to achieve this?
Currently I am using Emgucv in C#, but I am not sure what algorithm I should use that can achieve this. Any suggestions are appreciated.
Thank you.
You could just to an cv::absdiff to find the changed areas. After that, use findcontours to group the defects and draw an outline around them.
I am creating a dicom viewer using clear canvas library.
I need to find the image plane (axial, sagittal or coronal) of the dicom to implement triangulation.
My only hope was the Image Orientation tag (0020,0037), but some of the dicoms doesn't have that tag.
How can I find the plane from the dicom? Any help.
Regards,
Rohith
For many modalities, the exact image orientation is neither available nor - for normal use of the created images - required. In these cases you can resort to Patient Orientation (0020,0020) to establish how to hang the images. This information is however by no means exact enough for what you are trying to do. OTOH, if the modality doesn't supply the image orientation tag, I doubt that the images produced by that modality, are suitable for your purposes.
I want to achieve the results as shown in this image
Scale the selected area and embed some object. Please let me know which technique is best.
Cheers
Edit
Comments up!
Q1:Are you trying to modify ONE image, or several?
Several.
Q2:What image libraries do you intend to use?
It is my question, which i should use.
Q3:Do you want a completely automated process, or a semi-manual is OK?
I shall mark the area on face to scale and then select the object of my choice from a list, one image at a time.
Q4:What parameters do you want to specify?
Dimensions of selected area of the face and the object to insert (like orange in this example) –
Q5:Are you aware of face recognition algorithms?
I believe i don't need recognition algorithms because i am selecting the area on face manually. All I need to modify the selected area as shown in the sample image. –
I guess the obvious answer of use Adobe Photoshop is out of the question?
Basically I'm reading vehicle license plates using tessract OCR, however despite being able to emphasise text easily enough via changing contrast, reducing noise an so on, some 'parts' of the vehicle remain on the image which does cause the OCR to throw bad results.
For example take:
I can change this easily enough, such as:
I'm looking to eliminate the edges off each plate, here's another example:
I could remove the edges using pixel manipulation algorithm, however I don't feel it's the right method, and would cause quite a lot of problems.
I've been using the following application to test various methods such as morphology and eliminating the unwanted data, so far I haven't been successful.
http://www.codeproject.com/KB/GDI-plus/Image_Processing_Lab.aspx
However someone with knowledge of this could use the application on the article above to achieve want I'm trying, so feel free to give it a try.
Thanks
Please try to use stroke width transformation concept.
This concept use to segment text from natural images.....
I already did such an algorithm. I just can say that it works great. The secret is, that you need to know that the light is coming just from one side perhaps. You cannot set the image to "black/white" just by using ONE threshold.
Detect the average luminance of parts of the image and use this luminance calculation to set the threshold for each region.
For example, if the left top is lighter, you need a lower threshold to make these parts not to bright. And if the bottom right has low light, you need to set the threshold higher to receive all existing light information.
Then, you need just to drive into the image from each side by using the method:
IsPixelAboveThreshold ?
If it is below, you are on the border, if it is above, you can say you are on the middle of the image with more brightness.
Regards