From: Suchita on
I ran command line by line and when i tried to run the command
hueImage(mask>0) = .7;

it gave error like this:
??? In an assignment A(I) = B, a matrix A cannot be resized.

I think because of that i am not getting right output..How to get it error free?
"Suchita " <suchitamanandhar(a)hotmail.com> wrote in message <h86l33$lv1$1(a)fred.mathworks.com>...
> Hey,
>
> This code is not working. I mean it is giving just the binary image. But my need is to change the color of the selected part of the image like say blue and the rest of the unselected part as it is..How to get that ??
>
> "Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <h81uk1$m1f$1(a)fred.mathworks.com>...
> > "Suchita " <suchitamanandhar(a)hotmail.com> wrote in message <h81rdh$ki$1(a)fred.mathworks.com>...
> > > It would be great if we can keep the original intensity of the image and just give the slight color. But how to do that ?
> > >
> > >-----------------------------------------------------------------------------------
> > Suchita:
> > This will do that.
> > Good luck,
> > ImageAnalyst
> >
> > % Demo macro to tint the user drawn area blue.
> > % by ImageAnalyst
> > % function test
> > clc;
> > close all;
> > % clear all;
> > workspace;
> > % Read in a standard MATLAB test image.
> > rgbImage = imread('peppers.png') ;
> > % Display it.
> > subplot(1,3,1);
> > imshow(rgbImage);
> > set(gcf, 'Position', get(0, 'ScreenSize')); % Maximize figure.
> > % Ask user to draw a region.
> > uiwait(msgbox('Left click several points and then right click to finish'));
> > % Get the region as a mask.
> > [mask x y] = roipolyold;
> > subplot(1,3,2);
> > imshow(mask, []);
> > % Convert to HSV space. Get HSV version of the RGB image.
> > hsv_image = rgb2hsv(rgbImage);
> > hueImage = hsv_image(:,:,1);
> > % Tint the region inside where the user drew to be blue.
> > hueImage(mask>0) = .7;
> > hsv_image(:,:,1) = hueImage;
> > % Convert back to rgb space, and display.
> > tintedRGBImage = hsv2rgb(hsv_image);
> > subplot(1,3,3);
> > imshow(tintedRGBImage);
From: ImageAnalyst on
Suchita:
I just copied and pasted directly from the newsgroup posting and it
ran perfectly fine. You must have changed something. Maybe you
changed the image somewhere mid-stream or something. Maybe you didn't
use roipolyold but used roipoly instead. Who knows? But you
definitely did something because this code works. Somehow your mask
image is not the same size as your hueImage, which is NOT the case for
my code. Either do as I did - copy and paste directly from the
posting (where you'll verify that it does in fact work) - or show me
here what you did to change it.

When you set a breakpoint at the line, what does it tell you about the
size of hueImage and mask? They should be the same size. mask> will
be a different size (if you set that equal to an intermediate variable
you can verify that it'll be a 1D vector, but that's perfectly OK
because it's using logical indexing.
From: Suchita on
Ya I agree. But when i change the image to 'pout.tif', it doesn't work. Is it work only for one picture then ? what change should we have to make to run the program for any image ??

ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7edbc868-1a3b-4e43-8a88-185ebc1ce110(a)o9g2000yqj.googlegroups.com>...
> Suchita:
> I just copied and pasted directly from the newsgroup posting and it
> ran perfectly fine. You must have changed something. Maybe you
> changed the image somewhere mid-stream or something. Maybe you didn't
> use roipolyold but used roipoly instead. Who knows? But you
> definitely did something because this code works. Somehow your mask
> image is not the same size as your hueImage, which is NOT the case for
> my code. Either do as I did - copy and paste directly from the
> posting (where you'll verify that it does in fact work) - or show me
> here what you did to change it.
>
> When you set a breakpoint at the line, what does it tell you about the
> size of hueImage and mask? They should be the same size. mask> will
> be a different size (if you set that equal to an intermediate variable
> you can verify that it'll be a 1D vector, but that's perfectly OK
> because it's using logical indexing.
From: Suchita on
Or is it like the image should be only RGB not the gray scale one. But if I need to make it run for any kind of image(no matter whelther it is RGB or gray scale one) , is there any common way to do that ?

"Suchita " <suchitamanandhar(a)hotmail.com> wrote in message <h875ce$a08$1(a)fred.mathworks.com>...
> Ya I agree. But when i change the image to 'pout.tif', it doesn't work. Is it work only for one picture then ? what change should we have to make to run the program for any image ??
>
> ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7edbc868-1a3b-4e43-8a88-185ebc1ce110(a)o9g2000yqj.googlegroups.com>...
> > Suchita:
> > I just copied and pasted directly from the newsgroup posting and it
> > ran perfectly fine. You must have changed something. Maybe you
> > changed the image somewhere mid-stream or something. Maybe you didn't
> > use roipolyold but used roipoly instead. Who knows? But you
> > definitely did something because this code works. Somehow your mask
> > image is not the same size as your hueImage, which is NOT the case for
> > my code. Either do as I did - copy and paste directly from the
> > posting (where you'll verify that it does in fact work) - or show me
> > here what you did to change it.
> >
> > When you set a breakpoint at the line, what does it tell you about the
> > size of hueImage and mask? They should be the same size. mask> will
> > be a different size (if you set that equal to an intermediate variable
> > you can verify that it'll be a 1D vector, but that's perfectly OK
> > because it's using logical indexing.
From: ImageAnalyst on
On Sep 8, 11:06 pm, "Suchita " <suchitamanand...(a)hotmail.com> wrote:
> Or is it like the image should be only RGB not the gray scale one. But if I need to make it run for any kind of image(no matter whelther it is RGB or gray scale one) , is there any common way to do that ?
--------------------------------------------------------------------------------------------------------------
You can't have a blue tint unless the image is RGB. So convert your
monochrome images to RGB. You could use that cat(3,..) or ind2rgb()
functions.
Something like:

[rows columns numberOfColors] = size(imageArray);
if numberOfColors == 1
rgbImage = ind2rgb(imageArray);
end
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: GUI, pushbutton, callback
Next: BPSK demodulator