Thread Subject: How to handle uploaded image in Gui

Subject: How to handle uploaded image in Gui

From: Pulkit

Date: 13 May, 2009 02:24:01

Message: 1 of 9

Hi,

I have created a GUI & I use it to display images using imshow in the axes object.
I am unable to get the handle of this image & manipulate this image, ie performing colour space transfroms etc.

Thanx for help in advance.

Regards,
Pulkit.

Subject: How to handle uploaded image in Gui

From: vedenev

Date: 13 May, 2009 09:25:47

Message: 2 of 9

When you open image you use
[X, map] = imread(...)
Work with this X.
When you show image:
hi=imshow(X,map,'Parent',ha);
where ha is handle to axis (usualy "handles.axes1")
now "hi" is handle to image object.

------------------------------------
Maxim Vedenev, Matlab freelancer
vedenev@ngs.ru
http://simulations.narod.ru/

Subject: How to handle uploaded image in Gui

From: Pulkit

Date: 13 May, 2009 10:11:01

Message: 3 of 9

Hey, thnx a lot for tht.
I could manipulate with the image, but not with the individual pixels, like displaying the pixel value, the RGB value of a pixel etc.
Could you help me out with that ??

Regards,
Pulkit

vedenev <vedenev.maxim@gmail.com> wrote in message <93a98eeb-81dc-408e-8640-3142cc4542ac@u10g2000vbd.googlegroups.com>...
> When you open image you use
> [X, map] = imread(...)
> Work with this X.
> When you show image:
> hi=imshow(X,map,'Parent',ha);
> where ha is handle to axis (usualy "handles.axes1")
> now "hi" is handle to image object.
>
> ------------------------------------
> Maxim Vedenev, Matlab freelancer
> vedenev@ngs.ru
> http://simulations.narod.ru/

Subject: How to handle uploaded image in Gui

From: Image Analyst

Date: 13 May, 2009 12:41:01

Message: 4 of 9

"Pulkit " <pulkit.audacious1.remove1tomail@gmail.com> wrote in message <gue6bl$cla$1@fred.mathworks.com>...
> Hey, thnx a lot for tht.
> I could manipulate with the image, but not with the individual pixels, like displaying the pixel value, the RGB value of a pixel etc.
> Could you help me out with that ??
>
> Regards,
> Pulkit
------------------------------------------------------------------------------------------
Can you explain why not? You have the matrix of pixel values, so what's the problem???? There are lots of ways of displaying the value of the pixel in text form including disp(), sprintf(), just typing it on the command line, sending it to a text control on a GUI, msgbox(), etc. Similarly there are lots of ways of displaying the pixel value in intenstiy form such as image(), imagesc(), imshow(). What do you need help with????

And what do you mean by saying you "could manipulate the image but not with individual pixels"? I have no idea what this means. Do you mean that you can manipulate it by doing something to the whole array at a time, such as X = X/2? Well you can do individual pixels too, just do something like X(132, 419) = X(137,419) / 2 to "manipulate" the pixel at location (137,419). Why can't you do this?
-ImageAnalyst

Subject: How to handle uploaded image in Gui

From: Ben

Date: 13 May, 2009 12:44:01

Message: 5 of 9

"Pulkit " <pulkit.audacious1.remove1tomail@gmail.com> wrote in message <gue6bl$cla$1@fred.mathworks.com>...
> Hey, thnx a lot for tht.
> I could manipulate with the image, but not with the individual pixels, like displaying the pixel value, the RGB value of a pixel etc.
> Could you help me out with that ??
>
> Regards,
> Pulkit
>

Is this what you mean?

colorData= get(hi,'CData');
%Manipulate colorData as necessary
% after manipulating the matrix colorData send the changes back to the image.
set(hi,'CData',colorData)

Subject: How to handle uploaded image in Gui

From: Pulkit

Date: 13 May, 2009 13:00:19

Message: 6 of 9

Hi Ben,

Thnx for that.
I meant that, as I move my mouse pointer over the image, i want to get pixel data point by point & then I want to save these data values at certain pixels for future use.

The problem is how do I get the handle of the image in the GUI.
Once I use imshow() to display the image in the axes , the Buttondownfcn of the axes no longer works, thus i am unable to detect the current location of my mouse pointer on the image.

Thnx for the help.

Regards,
Pulkit


"Ben " <bta7905.nospam@msn.com> wrote in message <guefah$h41$1@fred.mathworks.com>...
> "Pulkit " <pulkit.audacious1.remove1tomail@gmail.com> wrote in message <gue6bl$cla$1@fred.mathworks.com>...
> > Hey, thnx a lot for tht.
> > I could manipulate with the image, but not with the individual pixels, like displaying the pixel value, the RGB value of a pixel etc.
> > Could you help me out with that ??
> >
> > Regards,
> > Pulkit
> >
>
> Is this what you mean?
>
> colorData= get(hi,'CData');
> %Manipulate colorData as necessary
> % after manipulating the matrix colorData send the changes back to the image.
> set(hi,'CData',colorData)

Subject: How to handle uploaded image in Gui

From: Steven Lord

Date: 13 May, 2009 13:59:16

Message: 7 of 9


"Pulkit " <pulkit.audacious1.remove1tomail@gmail.com> wrote in message
news:gueg93$jj1$1@fred.mathworks.com...
> Hi Ben,
>
> Thnx for that.
> I meant that, as I move my mouse pointer over the image, i want to get
> pixel data point by point & then I want to save these data values at
> certain pixels for future use.

I think from this description that you want either IMPROFILE or IMPIXEL from
Image Processing Toolbox.

> The problem is how do I get the handle of the image in the GUI.
> Once I use imshow() to display the image in the axes , the Buttondownfcn
> of the axes no longer works, thus i am unable to detect the current
> location of my mouse pointer on the image.

Take a look at these documents from the support website:

http://www.mathworks.com/support/solutions/en/data/1-3K8R2L/

http://www.mathworks.com/support/solutions/en/data/1-1B03X/

--
Steve Lord
slord@mathworks.com

Subject: How to handle uploaded image in Gui

From: Ben

Date: 13 May, 2009 18:09:02

Message: 8 of 9

"Steven Lord" <slord@mathworks.com> wrote in message <guejni$c08$1@fred.mathworks.com>...
>
> "Pulkit " <pulkit.audacious1.remove1tomail@gmail.com> wrote in message
> news:gueg93$jj1$1@fred.mathworks.com...
> > Hi Ben,
> >
> > Thnx for that.
> > I meant that, as I move my mouse pointer over the image, i want to get
> > pixel data point by point & then I want to save these data values at
> > certain pixels for future use.
>
> I think from this description that you want either IMPROFILE or IMPIXEL from
> Image Processing Toolbox.
>
> > The problem is how do I get the handle of the image in the GUI.
> > Once I use imshow() to display the image in the axes , the Buttondownfcn
> > of the axes no longer works, thus i am unable to detect the current
> > location of my mouse pointer on the image.
>
> Take a look at these documents from the support website:
>
> http://www.mathworks.com/support/solutions/en/data/1-3K8R2L/
>
> http://www.mathworks.com/support/solutions/en/data/1-1B03X/
>
> --
> Steve Lord
> slord@mathworks.com
>

I have seen something very similar to the GUI that you are describing. It was either a demo or on the user community. Unfortunately I could not find it but essentially you could mouse over an image and the RGB values of your current mouse position were displayed in 3 text boxes below the image. I believe it used the window motion function with a call back that gets the current mouse position over the axis (something like "gpos" in the file exchange) then it used the current mouse position as an X, and Y index into CData returning the 3 RGB values.

Hope that helps.

Subject: How to handle uploaded image in Gui

From: Kate

Date: 30 Jun, 2009 16:42:34

Message: 9 of 9

On May 13, 5:25 am, vedenev <vedenev.ma...@gmail.com> wrote:
> When you open image you use
> [X, map] = imread(...)
> Work with this X.
> When you show image:
> hi=imshow(X,map,'Parent',ha);
> where ha is handle to axis (usualy "handles.axes1")
> now "hi" is handle to image object.
Huge thanks for that - I was working on a medical imaging project
today and needed the GUI to set up an analysis for non-programmers.
This advice is exactly what I needed. Really appreciate your time in
typing it in.

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
pixel Pulkit 13 May, 2009 09:04:03
point pixel Pulkit 13 May, 2009 09:04:03
getting pixel v... Pulkit 13 May, 2009 09:04:03
image Pulkit 12 May, 2009 22:29:04
image handle Pulkit 12 May, 2009 22:29:04
image processing Pulkit 12 May, 2009 22:29:04
gui Pulkit 12 May, 2009 22:29:03
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com