Thread Subject:
Assign different grey scale value to different objects

Subject: Assign different grey scale value to different objects

From: user mat

Date: 20 Jun, 2012 15:51:06

Message: 1 of 9

Hi,

%%%%%%%%%%%%%%
input--> two binary images
output--> assign different grey scale value to different objects but the values that have assigned in case 1(first binary image) for different object should be similar in case 2 (second binary image)
 %%%%%%%%%%%%%%

case 1:
for first sequence(bin image) i use bwlabel command to label and count the separate objects in the scene. Let say bwlabel count 3 objects in my scene , and assign value respectively e.g result: (object1--> labe1=1; object2--> label 2 = 2 , object3--> label 3 =3) ,

case2:
for second binary image i use the same process as in case 1 let say in my second bin image, one of the object detected in case 1 is missing , and now the values are assigned in this way e.g result: (object2--> labe1=1; object3--> label 2 =2).
Now in case 2 object 1 and object 3 will have different grey scale values as compared to grey scale values in case 1

What i am trying to do here is that detected objects in case 2 should preserve the same grey scale values as in case 1,
forexample object 2 should have the value 2 (as in case 1 but not the value 1)and object 3 should have the grey scale value 3 (not 2) e.g result: (e.g object2--> labe2=2; object3--> label 3 =3) which is not the case here ?

Any suggestions how can i get the require output ? thanks in advance

Subject: Assign different grey scale value to different objects

From: Jeff EA

Date: 20 Jun, 2012 18:19:07

Message: 2 of 9

"user mat" wrote in message <jrsrha$cp1$1@newscl01ah.mathworks.com>...
> Hi,
>
> %%%%%%%%%%%%%%
> input--> two binary images
> output--> assign different grey scale value to different objects but the values that have assigned in case 1(first binary image) for different object should be similar in case 2 (second binary image)
> %%%%%%%%%%%%%%
>
> case 1:
> for first sequence(bin image) i use bwlabel command to label and count the separate objects in the scene. Let say bwlabel count 3 objects in my scene , and assign value respectively e.g result: (object1--> labe1=1; object2--> label 2 = 2 , object3--> label 3 =3) ,
>
> case2:
> for second binary image i use the same process as in case 1 let say in my second bin image, one of the object detected in case 1 is missing , and now the values are assigned in this way e.g result: (object2--> labe1=1; object3--> label 2 =2).
> Now in case 2 object 1 and object 3 will have different grey scale values as compared to grey scale values in case 1
>
> What i am trying to do here is that detected objects in case 2 should preserve the same grey scale values as in case 1,
> forexample object 2 should have the value 2 (as in case 1 but not the value 1)and object 3 should have the grey scale value 3 (not 2) e.g result: (e.g object2--> labe2=2; object3--> label 3 =3) which is not the case here ?
>
> Any suggestions how can i get the require output ? thanks in advance

I _think_ what you want is imreconstruct. This is assuming that the objects have the same/similar XY coordinates between the two images...and that I'm understanding your question.

Subject: Assign different grey scale value to different objects

From: user mat

Date: 21 Jun, 2012 09:32:09

Message: 3 of 9

Hi,

>This is assuming that the objects have the same/similar XY coordinates between >the two images...and that I'm understanding your question.

In my case although its true that i have same/similar objects in both images BUT the size and position of objects will vary that means XY coordinates between the two images will not be the same.

"Jeff EA" <jea@gene.dot.com> wrote in message <jrt46r$lk9$1@newscl01ah.mathworks.com>...
> "user mat" wrote in message <jrsrha$cp1$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > %%%%%%%%%%%%%%
> > input--> two binary images
> > output--> assign different grey scale value to different objects but the values that have assigned in case 1(first binary image) for different object should be similar in case 2 (second binary image)
> > %%%%%%%%%%%%%%
> >
> > case 1:
> > for first sequence(bin image) i use bwlabel command to label and count the separate objects in the scene. Let say bwlabel count 3 objects in my scene , and assign value respectively e.g result: (object1--> labe1=1; object2--> label 2 = 2 , object3--> label 3 =3) ,
> >
> > case2:
> > for second binary image i use the same process as in case 1 let say in my second bin image, one of the object detected in case 1 is missing , and now the values are assigned in this way e.g result: (object2--> labe1=1; object3--> label 2 =2).
> > Now in case 2 object 1 and object 3 will have different grey scale values as compared to grey scale values in case 1
> >
> > What i am trying to do here is that detected objects in case 2 should preserve the same grey scale values as in case 1,
> > forexample object 2 should have the value 2 (as in case 1 but not the value 1)and object 3 should have the grey scale value 3 (not 2) e.g result: (e.g object2--> labe2=2; object3--> label 3 =3) which is not the case here ?
> >
> > Any suggestions how can i get the require output ? thanks in advance
>
> I _think_ what you want is imreconstruct. This is assuming that the objects have the same/similar XY coordinates between the two images...and that I'm understanding your question.

Subject: Assign different grey scale value to different objects

From: user mat

Date: 22 Jun, 2012 08:17:06

Message: 4 of 9

Hi

Still waiting for the suggestions or some sample code ? Thanks

"user mat" wrote in message <jrupmp$pbj$1@newscl01ah.mathworks.com>...
> Hi,
>
> >This is assuming that the objects have the same/similar XY coordinates between >the two images...and that I'm understanding your question.
>
> In my case although its true that i have same/similar objects in both images BUT the size and position of objects will vary that means XY coordinates between the two images will not be the same.
>
> "Jeff EA" <jea@gene.dot.com> wrote in message <jrt46r$lk9$1@newscl01ah.mathworks.com>...
> > "user mat" wrote in message <jrsrha$cp1$1@newscl01ah.mathworks.com>...
> > > Hi,
> > >
> > > %%%%%%%%%%%%%%
> > > input--> two binary images
> > > output--> assign different grey scale value to different objects but the values that have assigned in case 1(first binary image) for different object should be similar in case 2 (second binary image)
> > > %%%%%%%%%%%%%%
> > >
> > > case 1:
> > > for first sequence(bin image) i use bwlabel command to label and count the separate objects in the scene. Let say bwlabel count 3 objects in my scene , and assign value respectively e.g result: (object1--> labe1=1; object2--> label 2 = 2 , object3--> label 3 =3) ,
> > >
> > > case2:
> > > for second binary image i use the same process as in case 1 let say in my second bin image, one of the object detected in case 1 is missing , and now the values are assigned in this way e.g result: (object2--> labe1=1; object3--> label 2 =2).
> > > Now in case 2 object 1 and object 3 will have different grey scale values as compared to grey scale values in case 1
> > >
> > > What i am trying to do here is that detected objects in case 2 should preserve the same grey scale values as in case 1,
> > > forexample object 2 should have the value 2 (as in case 1 but not the value 1)and object 3 should have the grey scale value 3 (not 2) e.g result: (e.g object2--> labe2=2; object3--> label 3 =3) which is not the case here ?
> > >
> > > Any suggestions how can i get the require output ? thanks in advance
> >
> > I _think_ what you want is imreconstruct. This is assuming that the objects have the same/similar XY coordinates between the two images...and that I'm understanding your question.

Subject: Assign different grey scale value to different objects

From: ImageAnalyst

Date: 24 Jun, 2012 18:57:08

Message: 5 of 9

Do you have access to the binary image from case 1 when you're working on case 2? I'd hope so otherwise there's no telling how many objects are missing from binary image 2. Let's say binary image 2 has 10 blobs in it. How can I know if blob 10 was blob 50 in image 1, or blob 300? How would I know if binary image 1 had 11 blobs in it, or 1000 blobs in it? If you don't know which blobs are missing (because image 1 is not available) then there is no way to reassign labels to match what they were in image 1. If you do have image 1 available then it's simple multiplication.

labeledImage1 = bwlabel(binaryImage1); % Number the blobs.
labeledImage2 = labeledImage1 .* double(binaryImage2); % 2 has same numbers as 1.

Subject: Assign different grey scale value to different objects

From: user mat

Date: 26 Jun, 2012 13:25:08

Message: 6 of 9

Thanks, Yes i have access to the binary image from case 1 and i also know that in case 1 i have three objects, and i also know that second or in third image will contain one/ two or all three objects. I tried your suggestions but this does not work for the case where the size of blobs/object changes and in my situation objects are also moving (your suggestion will work for the case when there is no motion/objects in case 1 and in case 2 (objects/blobs are in the same position/size) ?

I am particullarly interested in the case where i can assign the same grey scales (e.g 2 has same numbers / label as 1)to the same object located in image 2 at different location / also have different size.
Any suggestions ?

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <f35db328-23c9-46f4-83ab-0e39d5b9c996@googlegroups.com>...
> Do you have access to the binary image from case 1 when you're working on case 2? I'd hope so otherwise there's no telling how many objects are missing from binary image 2. Let's say binary image 2 has 10 blobs in it. How can I know if blob 10 was blob 50 in image 1, or blob 300? How would I know if binary image 1 had 11 blobs in it, or 1000 blobs in it? If you don't know which blobs are missing (because image 1 is not available) then there is no way to reassign labels to match what they were in image 1. If you do have image 1 available then it's simple multiplication.
>
> labeledImage1 = bwlabel(binaryImage1); % Number the blobs.
> labeledImage2 = labeledImage1 .* double(binaryImage2); % 2 has same numbers as 1.

Subject: Assign different grey scale value to different objects

From: ImageAnalyst

Date: 27 Jun, 2012 23:03:44

Message: 7 of 9

On Tuesday, June 26, 2012 9:25:08 AM UTC-4, user mat wrote:
> Thanks, Yes i have access to the binary image from case 1 and i also know that in case 1 i have three objects, and i also know that second or in third image will contain one/ two or all three objects. I tried your suggestions but this does not work for the case where the size of blobs/object changes and in my situation objects are also moving (your suggestion will work for the case when there is no motion/objects in case 1 and in case 2 (objects/blobs are in the same position/size) ?
-----------------------------------------------------------------
user mat:
If the objects don't move more than their size, then you can AND them together, and use imreconstruct. If the objects move a great distance then it's harder to tell and this becomes a tracking problem that requires prediction. It can be done but you have to make 3D models where you predict where a certain object should be along the time axis. I'm no expert there so you'll have to read up in the literature for that. You can start with sections 16, 17, and 18 here: http://iris.usc.edu/Vision-Notes/bibliography/contents.html
ImageAnalyst

Subject: Assign different grey scale value to different objects

From: user mat

Date: 28 Jun, 2012 11:31:06

Message: 8 of 9

thanks, In my case the objects don't move more than their size but i cannot use And e.g
letsay consider simple case

                     binaryImage1= 0 0 0 0 1 1 0 0 ---> object 2 in case 1
                     binaryImage2= 0 0 1 1 0 0 0 0 -----> object 2 in case 2(shift 1 pixels left)
          then And(bin1, bin2)= 0 0 0 0 0 0 0 0 i will loose all details
----------
Or in my case, as i am labeling the object so it has values e.g
                    binaryImage1= 0 0 1 1 0 0 0 0 ---> e.g object 2 in case 1
after labeling
                    labeledImage1= 0 0 2 2 0 0 0 0
                    binaryImage2 = 0 1 1 0 0 0 0 0 --> say i pixel shift on right
 And result would be = 0 0 1 0 0 0 0 0 (this is not what i want)

as i want to have and result = 0 2 2 0 0 0 0 0 so that object2 would have same value 2 as i case 1 (labeledImage2-> should have value 0 2 2 0 0 0 0 0 )
---------------------------------------------------------------------------------------------------------------------
>labeledImage1 = bwlabel(binaryImage1); % Number the blobs.
>labeledImage2 = labeledImage1 .* double(binaryImage2); % 2 has same numbers >as
   
any suggestions ??
   



ImageAnalyst <imageanalyst@mailinator.com> wrote in message <55eb96f0-e377-471c-9fa3-7c6a1b33bcf5@googlegroups.com>...
> On Tuesday, June 26, 2012 9:25:08 AM UTC-4, user mat wrote:
> > Thanks, Yes i have access to the binary image from case 1 and i also know that in case 1 i have three objects, and i also know that second or in third image will contain one/ two or all three objects. I tried your suggestions but this does not work for the case where the size of blobs/object changes and in my situation objects are also moving (your suggestion will work for the case when there is no motion/objects in case 1 and in case 2 (objects/blobs are in the same position/size) ?
> -----------------------------------------------------------------
> user mat:
> If the objects don't move more than their size, then you can AND them together, and use imreconstruct. If the objects move a great distance then it's harder to tell and this becomes a tracking problem that requires prediction. It can be done but you have to make 3D models where you predict where a certain object should be along the time axis. I'm no expert there so you'll have to read up in the literature for that. You can start with sections 16, 17, and 18 here: http://iris.usc.edu/Vision-Notes/bibliography/contents.html
> ImageAnalyst

Subject: Assign different grey scale value to different objects

From: user mat

Date: 2 Jul, 2012 12:17:07

Message: 9 of 9

Still waiting for the response !


"user mat" wrote in message <jshf9q$r8a$1@newscl01ah.mathworks.com>...
> thanks, In my case the objects don't move more than their size but i cannot use And e.g
> letsay consider simple case
>
> binaryImage1= 0 0 0 0 1 1 0 0 ---> object 2 in case 1
> binaryImage2= 0 0 1 1 0 0 0 0 -----> object 2 in case 2(shift 1 pixels left)
> then And(bin1, bin2)= 0 0 0 0 0 0 0 0 i will loose all details
> ----------
> Or in my case, as i am labeling the object so it has values e.g
> binaryImage1= 0 0 1 1 0 0 0 0 ---> e.g object 2 in case 1
> after labeling
> labeledImage1= 0 0 2 2 0 0 0 0
> binaryImage2 = 0 1 1 0 0 0 0 0 --> say i pixel shift on right
> And result would be = 0 0 1 0 0 0 0 0 (this is not what i want)
>
> as i want to have and result = 0 2 2 0 0 0 0 0 so that object2 would have same value 2 as i case 1 (labeledImage2-> should have value 0 2 2 0 0 0 0 0 )
> ---------------------------------------------------------------------------------------------------------------------
> >labeledImage1 = bwlabel(binaryImage1); % Number the blobs.
> >labeledImage2 = labeledImage1 .* double(binaryImage2); % 2 has same numbers >as
>
> any suggestions ??
>
>
>
>
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <55eb96f0-e377-471c-9fa3-7c6a1b33bcf5@googlegroups.com>...
> > On Tuesday, June 26, 2012 9:25:08 AM UTC-4, user mat wrote:
> > > Thanks, Yes i have access to the binary image from case 1 and i also know that in case 1 i have three objects, and i also know that second or in third image will contain one/ two or all three objects. I tried your suggestions but this does not work for the case where the size of blobs/object changes and in my situation objects are also moving (your suggestion will work for the case when there is no motion/objects in case 1 and in case 2 (objects/blobs are in the same position/size) ?
> > -----------------------------------------------------------------
> > user mat:
> > If the objects don't move more than their size, then you can AND them together, and use imreconstruct. If the objects move a great distance then it's harder to tell and this becomes a tracking problem that requires prediction. It can be done but you have to make 3D models where you predict where a certain object should be along the time axis. I'm no expert there so you'll have to read up in the literature for that. You can start with sections 16, 17, and 18 here: http://iris.usc.edu/Vision-Notes/bibliography/contents.html
> > ImageAnalyst

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us