Re: selecting a region of interest based on greyscale J value




mattyjbennett <mattyjbennett@xxxxxxxxxxxxxx> wrote in message <fdcdaa56-1f27-430e-9db3-07ff92b06080@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
Hi all,

I'm afraid i'm new to this, but making progress. I'm making a module
in Matlab 7.5 which is able to read an image as an RGB array, convert
to greyscale (J data) and have toyed with code to be able to report
back the J value stored at x,y coordinate, do doing ok so far.

The next step however is causing me some headache:

I want to open up a colour image in the viewer, select a few pixels
with the mouse and from their J values create a region of interest.
(similar to the 'magic wand' tool in Photoshop). I then want to save
the x,y coords of these pixels and also for each of the selected (will
probably only seelct about 5) export the pixel colour data and J value
to a database table, so:

From my image,

1, export each selected pixel (by the user) into a table, storing RGB
and J (greyscale) value for each. This dataset stored with a name
(e.g. actor 1's hat) which can be retrieved by another module later
on.

2. from the selected pixels and (I suspect using block operation /
nearest neighbour) determine all of the pixels which have similar J
values that are nearby and mark them out in a new array.

The intention is to the affect a new image stored as an I (RGB matrix)
which is in fact a greyscale image (no colour) but saved as a BMP or
JPG in RGB mode as I want to add colour to the image later on. (more
on that another time)

I realise that there could be a lot of similar data here so am only
interested in modal data (e.g. if there are lots of J data: 101,
132,133,133,139,133,133,101,101,102) I really only need to store:
101,133,139

I hope that makes sense. I'll send what I've done so far on the
initial coord selection below, but if any kind soul can help I'd be
grateful.

Best regards,

Matthew Bennett
Matthew:
For #1, you might want to take a look at the roipoly and roipolyold functions. Then use the poly2mask function to convert the polygon into a logical image which you can multiply by your original image to get just the drawn pixels. Crop the image beforehand if you want (there might be an imcrop command that you can use with the max and min x and y values derived from the roipoly output). Then you can save with either an imwrite() function or the save() function.

For #2, just use thresholding, something like:
toleranceGLs = 5;
differenceImage = abs(originalImage - meanGrayLevel);
inRangeImage = (differenceImage < toleranceGLs);
Use find() if you want actual row and column positions of the "in range" pixels.
.



Relevant Pages

  • selecting a region of interest based on greyscale J value
    ... in Matlab 7.5 which is able to read an image as an RGB array, ... I want to open up a colour image in the viewer, select a few pixels ... 1, export each selected pixel into a table, storing RGB ...
    (comp.soft-sys.matlab)
  • Re: BYTE Article of Mega II
    ... I believe that RGB matrix is constructed by TTL gating. ... If RGB matrix is a ROM, I am sure that four NTSC pixels out of 140 NTSC pixels will display on the screen at 98% correct. ...
    (comp.sys.apple2)
  • Re: How to put pixels and RGB in m-file??
    ... Can anyone help me to write the m-file for the pixels ... >> I used imtool and it gives the pixels and RGB of the image ... > a given threshold on all three planes. ...
    (comp.soft-sys.matlab)
  • Re: cryptanalysis on steganographic content within a PNG
    ... Consider the RGB values of the pixels in the "uniform" rows. ... RE RGB values top to bottom, left to right: ... The gradient runs left to right top to bottom suggesting that that is ...
    (sci.crypt)

Loading