I have searched the internet thoroughly but couldn't find a solution
Here what i want
This is my image
This is how it looks with 0 transparency when i have selected
So programmatically i want to split image into 6 pieces. Each one containing one of the egg with 0 transparent area left
How can i do that?
My preferred solutions based on c# or photoshop script but i am open to all solutions
An example output
To solve this problem for any image size, egg size, orientation, position, count I suggest to use the following approach:
Load the image file.
Extract the alpha channel (this contains the transparency information)
find the egg blobs (blob search/analysis, region labelling, connected components, countless names for this method)
get the bounding boxes of those blobs
crop the sub images using those bounding boxes
This can be achieved with most image processing librarys. If you prefer C#, give EmguCV a try. Or use websearch to find others.
http://www.emgu.com/wiki/files/3.1.0/document/html/e13fa7a9-5eee-b46c-4b65-ff3e7e427719.htm
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'm able to fill a rectangle with an image and i apply a mask on top of the image using this code
args.DrawingSession.FillRectangle(rect, imgRnd, mask);
i need to apply some transform to this image, i'am able to do that with no issue, but i have encounter a strange issue, the last pixel is repeated.
i have used
imgRnd.ExtendX = CanvasEdgeBehavior.Wrap;
imgRnd.ExtendY = CanvasEdgeBehavior.Wrap;
and the image is repeated continuously.
My question is : there is a way to draw one time the image disabling and ExtendX and ExtendY?
FillRectangle will always fill all the pixels within the specified rectangle. The edge behavior enum controls what value they are filled with if the image is positioned such that it does not completely cover the rectangle being drawn.
How exactly are you transforming the image? Can you change that to also transform the rectangle itself, so you won't be trying to fill pixels that aren't covered by the image?
Another option is to use image effects (Microsoft.Graphics.Canvas.Effects namespace) which give much more detailed control than FillRectangle over how multiple images are transformed, combined, etc.
I have a white map of country with black edges of provinces. I want to recognize areas of provinces and keep pixels of each province. Then I would like to color this areas(as polygon) by different colors. I would be grateful if you could help me. I know that exist AForge.Net library but I didn't find any helpful information.
If you can get a good binary image by thresholding the original one, you can try 'connected component analysis'. See for example here:
OpenCV how to find a list of connected components in a binary image
By a 'good' binary image I mean one where the provinces are completely separated by the black boundaries.
I'm writing a CSS sprite sheet generator. I know there are several decent ones out there, but this is more a personal interest project than anything. I've got a decent algorithm now, but I'm ending up with a lot of leftover whitespace due to the way I'm calculating the position for the next image to pack. So my thought was this:
Given images A and B in C#, how could I find the top-left-most transparent area in image A that would accomodate the area of image B? In other words, assuming image B is a 10x10 image, how could I find the first 10x10 transparent area in image A (assuming there is one)?
I'm diving into something without sufficient background, but I feel like there may be simple solutions that don't require me to have in depth knowledge of the topic.
What I am trying to do is have an image co-ordinate system. Basically the user will supply an image, like a house plan. They can then click on points in the image and create markers (like google maps). The next time they retrieve the map, all the markers they added before are there and they can add new ones.
I need to identify the points these markers are located on so I can store that information. I also need to be able to create a layer on the image that contains the markers and renders them in the exact locations they were placed.
I imagine the easiest way to do this is to use pixel co-ordinates...the rub here is that the image won't be a fixed size since there is a web application and an IPad application, so the co-ordinate system needs to work as long as the image is in the same size ratio.
The server size is .NET and as mentioned there is an IPad app, so the solution needs to be viable given that tech stack.
Any ideas?
Instead of using pixel coordinates in absolute terms, you can use the 0 to 1 range. The top left corner is (0,0), bottom right is (1,1) and the center of the image is (0.5,0.5). This way not matter what image size (or zoom level) you have, the markers will always be in the same place.
My suggestion is don't try to figure out the correlation between the actual image and the coordinates. The only thing I would do is use the resolution of the image, aka 800x600 and use that for your grid. Then overlay your markers using that grid on the image. The points you'd remember would just be X and Y values and maybe a tag name/id.