image using

  • Follow


when i add background image to my program, everything gets inverted, like my ball stars to bounce with the cieling rather than to floor. what error i am doing ? i am doing it by imread and imshow function.
and also how can i set the size of image to that is required?

Thank You :)
0
Reply owais.ashraf (4) 4/21/2012 12:14:07 PM

On Apr 21, 8:14=A0am, "Owais " <owais.ash...@live.com> wrote:
> when i add background image to my program, everything gets inverted, like=
 my ball stars to bounce with the cieling rather than to floor. what error =
i am doing ? i am doing it by imread and imshow function.
> and also how can i set the size of image to that is required?
>
> Thank You :)

---------------------------------------------------------------------------=
--------
Try calling "cla reset" before you call imshow.  That should upright
everything.  One wild guess, you don't have your camera upside down do
you?  Does your video look normal in other apps which use video?

To set the size, you can use
set(handlesToAxes, 'Position', [x y width height]);
0
Reply imageanalyst (7590) 4/21/2012 3:52:16 PM


"Owais " <owais.ashraf@live.com> wrote in message <jmu8af$4cc$1@newscl01ah.mathworks.com>...
> when i add background image to my program, everything gets inverted, like my ball stars to bounce with the cieling rather than to floor. what error i am doing ? i am doing it by imread and imshow function.
> and also how can i set the size of image to that is required?
> 
> Thank You :)

You have remembered that images label the TOP left pixel as 1,1, whereas normal cartesian coordinates would label the BOTTOM left corner of a graph/plot as 1,1, and so generating a sort of pictorial inversion?

Regards

Dave Robinson
0
Reply dave.robinson (1276) 4/22/2012 2:43:06 PM

"Dave Robinson" wrote in message <jn15dp$lmn$1@newscl01ah.mathworks.com>...
> "Owais " <owais.ashraf@live.com> wrote in message <jmu8af$4cc$1@newscl01ah.mathworks.com>...
> > when i add background image to my program, everything gets inverted, like my ball stars to bounce with the cieling rather than to floor. what error i am doing ? i am doing it by imread and imshow function.
> > and also how can i set the size of image to that is required?
> > 
> > Thank You :)
> 
> You have remembered that images label the TOP left pixel as 1,1, whereas normal cartesian coordinates would label the BOTTOM left corner of a graph/plot as 1,1, and so generating a sort of pictorial inversion?
> 
> Regards
> 
> Dave Robinson

No I didn't knew about this pixel thing :/
0
Reply owais.ashraf (4) 4/22/2012 5:13:06 PM

Yeah, but imshow() and other image display routines that that into
account seamlessly.  I'm still betting on the camera being upside
down.  With many machine vision cameras, they are just a rectangular
block so it's not obvious what is the top and what is the bottom.
0
Reply imageanalyst (7590) 4/22/2012 6:19:46 PM


"ImageAnalyst" <imageanalyst@mailinator.com> wrote in message 
news:4d2a43bf-b0f9-4655-a004-96efceb84488@2g2000yqp.googlegroups.com...
> Yeah, but imshow() and other image display routines that that into
> account seamlessly.

Yes, by changing the YDir property of the axes, which would cause the effect 
the OP reported.

http://www.mathworks.com/help/techdoc/ref/axes_props.html#XDir

When called in its "high level" form, IMAGE does change the YDir property.

http://www.mathworks.com/help/techdoc/ref/image.html

figure; set(gca, 'YDir', 'normal'); hold on; image(rgb)
figure; set(gca, 'YDir', 'reverse'); hold on; image(rgb)
figure; image(rgb)

> I'm still betting on the camera being upside
> down.  With many machine vision cameras, they are just a rectangular
> block so it's not obvious what is the top and what is the bottom.

If the camera were upside down, the ball the OP mentioned would still be 
bouncing toward the floor, but the floor would be where the ceiling should 
be and vice versa. I'm guessing the OP's trying to put a background image on 
the figure created by the BALLODE demo to display the bouncing ball and 
somehow the YDir property isn't being set as they expect.

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Reply slord (13282) 4/23/2012 2:44:10 PM

Owais, did you, for some reason, change the YDIR property of your
axes, and then call "hold on", which would counteract the normal
operation of image() and imshow() and prevent them from working as
expected?

So we can check, what do you get when you say this:

currentYDirection = get(gca, 'YDir')
0
Reply imageanalyst (7590) 4/23/2012 2:56:14 PM

6 Replies
41 Views

(page loaded in 0.114 seconds)

Similiar Articles:













7/22/2012 6:32:40 PM


Reply: