how to label a binarized image? - image-processing

please help me to segment a image in binary image...
more clearly,
i got a image from background subtraction, which is binary...means, the object area is of white color and non object object is black..now problem is how to label that white area?
i m using c#.net.

If by "label the white area" you just mean create a bucket with a label (e.g., "TheObject") and add all the connected white pixels to it, then the most straightforward way is the so-called "sequential algorithm".
The two-pass algorithm described here is also easy to implement.

using python, you will find the tools you need at:
http://luispedro.org/software/mahotas
under java use ImageJ with Landini's morphological plugins

Related

Is anyone has idea about Palm line detection in iOS Swift?

Currently, I am doing Image COLOUR filtering operation second MEDIAN filtering then CANNY EDGE DETECTION ALGORITHM.
Then, I read pixels using for loop and I draw lines using pixel, but I do not getting proper result for palm scanning and showing lines on human Palm.
So if anybody has any types of idea regarding this then please let me know.
Currently i am getting this type of result:
but I need this type of output:
Oh I got your problem, You can do this by following steps.
1.process your hand image with canny edge detection algo lets name that cannyImage.
2.now create the bitmap of cannyImage and remove black pixels from the image and replace them with transparent pixels, black only because canny image will be filled with black color and objects lines in white when you process the image through the algo, now you have extracted the image with palm lines white in color, lets name that palmLineImage.
3.now the main part is MASKING you need to mask the palmLineImage on the original image.
These three steps will give you your desire O/P.
Tools you can use GPUImage awsesome library by BradLarson for this https://github.com/BradLarson/GPUImage2
For refining the palm image from background which I'm sure you have to use in future you can use GrabCut algo
LINK - https://github.com/naver/grabcutios
and now the apple has launched Photos captured in Portrait Mode on iOS 12 contain an embedded person segmentation matte that made it easy to create creative visual effects like background replacement.
Links - https://developer.apple.com/videos/play/wwdc2019/260/ , https://developer.apple.com/videos/play/wwdc2019/225/
Looks like you need to use something like the douglas peucker algorithm - to simplify the number of data points and smooth the lines. link - https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm

OpenCV Separate background and foreground of an image based on red and green marker

I just start exploring computer-vision field and I'm trying to create something like this (this image is what I'm trying to achieve not what I've already achieve)
My approach is (just a logical solution, havent try it yet):
Color detection.
First, get pixel position of lines with red and green color then add all that value to arrayRed and arrayGreen.
Segmentation
Get base image from cache then get all pixel with value that close to arrayRed and label it as label background. Do the same for arrayGreen
Convert color space to RGBA and set the Alpha of label background to 0
My question :
Am I on the right path?
Is this possible to achieve with OpenCV library?
If my approach is wrong, what's the efficient and actually right approach(in pseudo-code or python) to achieve the goal?

Cropping image By selecting Object and color matching

We are developing an app where we need to crop an image according to the selecting object area. User will draw a line and we need to select the object and crop it .This crop need to be like the app: YourMoji
So far we have tried to get the color of the pixels along the line and then comparing those with the color of every pixel in the image and making a path from it to clip the image. But the almost going no where.
Is it possible through this way to crop an image or we are going in the wrong way? Can anyone provide a way to do this Or suggest a way to modify the way we have worked so far? Any advice and suggestions will be greatly appreciated!
Thanks in advance.
I guess what you want is the image segmentation algorithm called Graph Cut.
Here are two Github repositories, hope these would help:
GraphCut
GrabCutIOS
I'm not exactly clued up on image manipulation, but the first algorithm that comes to mind is something like this:
Take the average of the pixels in the line (as you have)
Since you appear to want faces, you might want to weight reds and blues over green. Not much green in faces of any skin tone.
For each pixel, if the colour is within a given threshold outside of your selected average, remove it / make transparent.
Perhaps the closer to the original line (or centroid), the less strict the threshold becomes.
I'd then provide the user with some tools for:
Sensitivity: how large the threshold is
Eraser: to remove parts of the image that your algorithm missed
Paintbrush: to replace parts of the image that your algorithm incorrectly removed.

Adding color to selected areas in ImageJ

I want to measure the area of a group of clumped cells with blurred margins. I cannot set a threshold and measure the ROIs as the edges are not clear. I have to manually select the ROIs. I would then like to color in the ROIs of same area with one color so that it is easy for visualization. I want to show that that in my tissue sample there are cells of different sizes.
Please suggest how I can fill the ROIs with the same area with a color. Is there a better way to do this?
Thanks
There's a macro called ROI Color Coder that colors measured ROIs according to size. That might be close to what you want.
The easiest way to add it to ImageJ is to use the Fiji distribution of ImageJ and activate the "BAR" update site. That way you get any updates automatically.
Check out the ImageJ forum too -- it's a good place to get answers about using ImageJ.
Hope this helps.

Expanding Solid Color Shapes in GIMP to Eliminate Whitespace

I'm trying to find some functionality in GIMP (with or without a plugin, doesn't matter) that can take an image of several solid color shapes separated by white space and "grow" those shapes outward until they completely eliminate all white space on the canvas. I believe this functionality could be accomplished with a voronoi diagram, but I can't seem to find anything in the GIMP plugin registry or included filters that accomplish this. Anybody have suggestions?
You don't describe how you want your colors to behave when they overlap - but you can try either the filters->generic->erode filter, or filters->distort->value propagate, with the "more black" option. Repeat the application of the desired filter by pressing ctrl + f at will. If you want a more specific behavior for when colors meet each other, you will have to write our own filter, I think.

Resources