How to recognize a certain zone in a image - vb.net

I'm wondering if it's possible to detect the grid in this image and then output the letters in each cells? (sorry if it's unclear, and I know this image is a game but it Wil be for a sudoku solver)
image from words blitz
I know I'll need to use OCR but how to detect the position?

Related

How to detect an image between shapes from camera

I've been searching around the web about how to do this and I know that it needs to be done with OpenCV. The problem is that all the tutorials and examples that I find are for separated shapes detection or template matching.
What I need is a way to detect the contents between 3 circles (which can be a photo or something else). From what I searched, its not to difficult to find the circles with the camera using contours but, how do I extract what is between them? The circles work like a pattern on the image to grab what is "inside the pattern".
Do I need to use the contours of each circle and measure the distance between them to grab my contents? If so, what if the image is a bit rotated/distorted on the camera?
I'm using Xamarin.iOS for this but from what I already saw, I believe I need to go native for this and any Objective C example is welcome too.
EDIT
Imagining that the image captured by the camera is this:
What I want is to match the 3 circles and get the following part of the image as result:
Since the images come from the camera, they can be rotated or scaled up/down.
The warpAffine function will let you map the desired area of the source image to a destination image, performing cropping, rotation and scaling in a single go.
Talking about rotation and scaling seem to indicate that you want to extract a rectangle of a given aspect ratio, hence perform a similarity transform. To define such a transform, three points are too much, two suffice. The construction of the affine matrix is a little tricky.

how to detect an image with iPhone camera?

I am trying to detect an image of a chocolate wrapper with iPhone/iPad Camera.
I already got the image frames from video using avcapture.
But i can't figure out how to detect a specific part of the image?
Note:- the specific part i am mentioning is a pink ribbon which will always be the same.
can i match the image? if yes how? or should i get bitmap pixel data and match the unique color codes (but they can vary depending on light conditions and angle at which image is taken)?
Try the following two APIs:
http://www.iqengines.com;
http://intopii.com
This Solution is for the scenario where you are trying to detect specific part of the image with a specific colour (This part will be called Reference image). so we are going to match the colour codes of our reference image with the one taken from the camera in real time.
Step 1.
Create a media layer which will scan the particular part of the image taken from camera. This will narrow down the search area for colour codes and make the process faster, as there are thousands of colour codes in the image.
Step 2.
Get the colour codes from the image we just scanned.Create an array of the colour codes.
Step 3.
Now repeat the step 2 for 3 or 4 different light conditions.Because some colour codes change under different types of lights. Match the colour codes array to get the common colour codes.(These will be referred now on as Reference colour codes) These colour codes will be there for most of the cases.
Step 4.
Convert the image taken from camera in a pixel buffer.(Basically a collection of pixels). Now convert the pixel buffer into colour codes and compare them with reference colour codes.If all of them or more than 50% are matched. you have potential match.
Note:- i Followed this process and it works like magic. it sounds more complicated than it is and it is enough robust to help you get it working in few hours. In my case the wrapper i was scanning was squeezed and tested under different lights(sun,white CFL lamp, a yellow light from the bulb, and taken from different angles and distances). Still most of the reference colour codes were always there.
Gud luck!

Is there a way to take an image file and make its background transparent via VB .NET?

We have a system where people are being taken a face shot via a DSLR camera. We need the people's images with transparent background. What we're currently doing is taking the image and editing and cropping it in Photoshop, removing the background image with the Magic Eraser tool.
What I am looking for is a way to parse the image and automatically erase the semi-white background we have, along with the resizing and cropping. Is there some kind of library or code sample that does this without requiring manual intervention?
This is a real complex problem. Like the answer below suggested you'll need to do a fuzzy match on each pixel and set it to be transparent but you also need to detected other nearby pixels to make sure they are not close in color. A white tag on the shirt, white eyelids, hair, pale skin reflecting the flash. All are candidates to be removed by any greedy fuzzy logic.
Think about the Magic Wand tool in Photoshop. How good is it at detecting the edges of the person in the picture? Yeah, and that's the top standard of image editing software with thousands of engineering hours behind it.
This is not a feasible request for a Q&A format, and this is one of those things that humans just do better than machine. BUT, that doesn't mean it's not possible, and who knows, you might be the one to do it. Just don't do it in VB.NET please :)
Some pseudo-code to get an idea of what you need to do:
Bitmap faceShot = Bitmap.FromFile(filepath)
foreach pixel in faceShot
//the following line is where the magic happens, you can do any fuzzy match on the color that suits you
//figure out your color range and do a fuzzy match percentage wise
if (pixel between RGB(255,255,255) and RGB(250,235,215)) //white and antique white
pixel.setAlpha=0
endif
end foreach
You could start with this as a starting point for processing a single image,
http://www.java2s.com/Code/VB/2D/ProcessanImageinvertPixel.htm
Basically, if you have a constant background color (like the TV green-screen), it's just a matter of selecting pixels close to the color you are erasing and setting their Alpha level to 0 (transparent). Treating the RGB values like XYZ coordinates, you can do a 3d distance from your background color, and make everything within a certain threshold transparent.
As an improvement, you could also make everything within another threshold semi-transparent so the edges right around hair and stuff like that look softer and less harsh.
Alternatively, you could probably do the same exact thing with good results in Photoshop, as it should support batch processing.
Edit, thinking about it some more, you may want to use a green screen type background as well instead of an off-white one like you stated, as you may make people's eyes transparent. I would definitely try to batch it in Photoshop/Gimp/etc.

How to crop a UIImage by selecting an area

I'm searching for a posibility to crop UIImages. I've found lots of examples via google how to do this, but I want to do a bit more than just croping the image.
It would be nice if the user can choose which area of the UIImage will be crop. In other languages, for example Javascript, there are many plugins to do that. I'm looking to find something like this:
http://odyniec.net/projects/imgareaselect/
Does anybody know if some similar project exists for objective-c? Thank you!
after days of searching I found out that there is no "plugin" which is similar to ImgAreaSelect. :-(
The best thing I found was this:
https://github.com/barrettj/BJImageCropper
It wasn't very hard to adapt this project to my needs: now I can choose a proportional area with min size. :-)
You could always make a black&white mask of this area and then mask the image (white area on mask will result in transparent area on masked image).
Link to nice tutorial on how to mask an image.
As an addition you could later calculate the miminum square frame that holds complete masked (cropped) image and crop the result - to get rid of excess transparent areas.

Spritesheet: tool to get coordinates

I have a one spritesheet image with all sprites, I downloaded this image from Interent. My question: Is there a tool that help me to get the coordinates of each sprite? would I have to search coordinates manually ?
I've been reading several tutorials like:http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d and http://indiedevstories.com/2011/04/10/using-sprite-sheets-in-cocos2d-and-tiled-part-1/, but all them use multiple images to create one spritesheet and generate automatically the .plist, but this is not my case.
In my case I have only one .png and no .plist
Help me please!!!
Apologies for the self-promotion but I have created a tool for working with single spritesheet images and outputting the coordinates. It even has automatic sprite selection :)
http://www.darkfunction.com/editor
You can crop the images using some editor (photoshop for example) and then use the exiting tool to generate the texture and the plist. I think it will be the fastest and the easiest way because in case you would want to generate only plist you will do the same operation - selecting the rectangle.
Use preview to crop out all the images separately. Then use zwoptex or texture packer to combine them all and generate the spritesheet with .png and .plist
Other than that it is difficult to figure out what is the rect of each image. If you are a good programmer you can write a tool to analyze the png and extract out the information which can be used to identify the rectangles, but my advice is to do it manually.
Divide your image using an image editor. Then add it to a spritesheet generator (like Sprite Master). Then you are free to make your output as you want by just changing the parameters.
Sprite Master will have a feature like parsing prepared spritesheet to individual images in following versions.