how to find out the number of cells that are common in segmented image and reference image in matlab - matlab

I done segmentation of the breast cancer cells with 2 algorithms.the next step is to evaluate the 2 algorithms using sensitivity and positive prediction value.so i count both the no.of cells segmented image and reference with 49 and 27 cells respectively.next i have to find out the no.of cells that are present in reference image and segmented image,no.of cells that are present in reference but not in segmented image and no.of cells that are not in reference but present in segmented image.both the images are gray scale.

The issue here is how to give cells identity that will be consistent between different segmentation methods. With your segmentation result, I suppose you can calculate geometric center for each cell in both cases. Starting from reference image, if you're looking for the same cell in the segmented case, search within a certain distance ( e.g 1/2 of a cell's maximum length ) of each cell's geometric center and see if there's any cell in the segmented case whose geometric center falls within this range. Then you have your count. It'd be better if you post your codes here so answers can be more specific.

Related

How to render a custom GridView based on the JSON response from Server for Flutter(Android)?

I am designing a plant tracking app for which I need to render grids, the problem is the fields are uneven and so some grids are rectangular, some are square and some are uneven as well and I need to track each and every plant as a grid cell, and each plant has a different lifecycle and different set of rules for transplantation, germination, fruiting dates, plus each plant's most important rule is the spacing i.e some plants can be spaced at a distance of 60cm from each other but some require 400cm, so based on this data I want to render a cell wherein the size of the grid cell is determined by the plant's spacing and the color should be red after it is planted once, plus I can render the uneven Grids as well.
Is it possible to have such a GridView?
Here's the thing I am trying to achieve but the exception test cases are that it will not be limited to a square or a rectangle. Like in the image I have shown the red marked area, that's the different test cases I would like to cover.

How to find height of the specific point in this OCT image?

I am a beginner in Matlab who is working on medical image processing of retinal OCT images. My aim is to align all the images to 1 height value. I want to find the maximum height of the layer in the eye.
For example, if input :
the output: returns this height:
I have tried this approach as outlined in Hand_height but it returns the height of the complete image.
Iterate over X and find the first peak (blue point) using findpeaks in the vertical direction (Y) to generate the first layer (blue line),
and then determine the peak with the smallest index in the Y-direction.
Please see the image!
In order to find maximum high you should find the top border of a retina.Here you have an example of how to find it.

Image segmentation algorithm in MATLAB

I need to implement an image segmentation function in MATLAB based on the principles of the connected components algorithm, but with a few modifications. This is intended for very simple, 2D images, with a background color and some objects in different colors.
The idea is that, taking the image as a matrix, I provide a tool to select the background color (it will vary for every image). Then, when the value of the color of the background of the image is selected, I have to segment all the objects in the image, and the result should be a labeled matrix, of the same size of the image, with 0's for the background, and a different number for each object.
This is a graphic example of what I mean:
I understand the idea of how to do it, but I do not know how to implement it on MATLAB. For each pixel (matrix position) I should mark it as visited and then if the value corresponds to the one of the background, assign 0, if not, assign another value. The objects can be formed by different colors, so in the end, I need to segment groups of adjacent pixels, whatever their color is. Also I have to use 8-connectivity, in order to count the green object of the example image as only one object and not 4 different ones. And also, the objects should be counted from top to bottom, and from left to right.
Is there a simple way of doing this in MATLAB? I know the bwlabel function, but it works for binary images only, so I'd like to adapt it to my case.
once you know the background color, you can easily convert your image into a binary mask of the same size:
bw=img!=bg_color;
Once you have a binary mask you can call bwlavel with 8-connectivity argument as you suggested yourself.
Note: you might want to convert your color image from RGB representation to an indexed image using rgb2ind before processing.

How to extract LBP features from facial images in MATLAB?

I'm not familiar with Local Binary Pattern (LBP), could anyone help me to know how to extract LBP features from facial images (I need a simple code example)?
While searching, I found this code, but I didn't understand it.
So first of all you need to split the face into a certain amount of
sections.
For each of these sections you then have to loop through the all of
the pixels contained within that section and get their value (grey scale or colour values).
For each pixel check the value of the pixels which border it in (diagonals and up down left and right) and save them
for each of the directions check if the colour value of. if the colour is greater than the original pixels value you can assign that value a 1 and if it is less you can assign it as a 0.
you should get a list of 1's and 0's from the previous steps. put these numbers together and it will be a large binary number, you should be able to convert this to decimal and you will have a number assigned for that pixel. save this number per pixel.
after you have got a decimal number for each pixel within a section you can average all of the values to get an average number for this section.
This may not be the best description of how this works so here is a useful picture which might help you.
There is an extractLBPFeatures function in the R2015b release of the Computer Vision System Toolbox for MATLAB.

Count black spots in an image - iPhone - Objective C

I need to count the number of black spots in an image(Not the percentage of black spots but the count). Can anyone suggest a step wise procedure that is used in image manipulation to count the spots.
Objective : Count black spots in an image
What I've done till now :
1. Converted image to grayscale
2. Read the pixels for their intensity values
3. I have set a threshold to find darker areas
Other implementations:
1. Gaussian blur
2. Histogram equalisations
What i have browsed :
Flood fill algorithms, Water shed algorithms
Thanks a lot..
you should first "label" the image, then count the number of labels you have found.
the label operation is the first operation done in a blob analysis operation: it groups similar adjacent pixels into a single object, and assign a value to this object. the condition for grouping generally is a background/foreground distinction: the label operation will group adjacent pixels which are part of the foreground, where background is defined as pure black or pure white, and foreground is any pixel whose color is not the color of the background.
the label operation is pretty easy to implement and requires not much resources.
_(see the wikipedia article, or this page for more information on labelling. a good paper on the implementation of the label operation is "Two Strategies to Speed up Connected Component Labeling Algorithms" by Kesheng Wu, Ekow Otoo and Kenji Suzuki)_
after labelling, count the number of labels (you can even count the labels while labelling), and you have the number of "black spots".
the next step is defining what a black spot is: converting your input image into a grayscale image (by converting it to HSL and using the luminance plane for example) then applying a threshold should do it. if the illumination of your input image is not even, you may need a better thresholding algorithm (a form of adaptive threshold)...
It sounds like you want to label the black spots (Blobs) using a binary image labelling algorithm. This should give you a place to start