RE: Show Image problem

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: Suman Nath (sknath@cmu.edu)
Date: 01/30/03


All,
Thanks to all who pointed out the bug in showImage, and provided a solution.

The tool showImage was a tool that we addded at the last moment for the
project, and could not test it extensively. The reason it fails is this: it
assumes the image in the shared memory to be a 4 channel (32 bits) image,
and so tries to open a shared memory of size (640 x 480 x 4). However, all
the images we gave you in the "images/" directory are of 3 channels, and so
loadImage creates the shared memory segment of size (640 x 680 x 3). Thus
loadImage fails when it tries to open the existing shared memory segment as
larger-size segment.

Then why did it work when we showed it in the class? In the class, we first
showed you the webcam tool that creates the shared emmory segment and copies
the live webcam frames there. The webcam frames are of 4 channels. Thus
running the webcam tool first creates the shared memory segment of size (640
x 480 x 4), which is of the same size loadImage tries to open -- so
loadImage can successfully open the shared memory segment.

Note that, the bug in the showImage code is just in the part where it tries
to open an existing shared memory (which fails if you specify a size larger
than the existing segment size) -- OpenCV APIs seamlessly work for both the
3- and 4-channel images, so you do not need to worry whether the image in
the shared memory segment is of 3 or 4 channels (i.e. whether the image in
the shared memory has come from the webcam or from loadImage).

Suman

-----Original Message-----
From: Mahim Mishra [mailto:mahim@cs.cmu.edu]
Sent: Thursday, January 30, 2003 4:04 AM
To: Gaurav Kataria
Cc: Suman Nath; irisnet-course@intel-iris.net
Subject: Re: Show Image problem

There's a bug in showImage: it asks for a shared memory segment that is
larger than the one created by loadImage, which causes shmget to throw an
EINVAL error. Reducing the segment size in the call to shmget in showImage
(I have found that even 0 works in this case) solves this problem.

Mahim

On Wed, 29 Jan 2003, Gaurav Kataria wrote:

>
> Suman,
>
> The showImage doesn't work. I am still getting no image displayed. It says
> reading from shared memory with SHM_KEY=75...but does not display.
>
> Gaurav
>
> On Tue, 28 Jan 2003, Suman Nath wrote:
>
> >
> > To use showImage, you first need to load an image into the shared memory
> > with key=75. The image should be of resolution 640x480. You can use the
> > images in SA/IrisWebcam/images directory.
> >
> > After you have loaded the image into shared memory, you can use the
> > showImage to see the image.
> >
> >
> >
> > On Tue, 28 Jan 2003, Gaurav Kataria wrote:
> >
> > >
> > > Thanks! It's ok now. Could you solve another problem for me? While
using
> > > showImage- it shows
> > >
> > > Reading from the shared memory with SHM_KEY=75. To use different
SHM_KEY,
> > > use 's[irisnet@localhost IrisWebcam]$ ing shared segment
> > >
> > > It does not display the image. Do I have to setup a viewer? Or is it
> > > because of the Camstream not being properly installed? Or something
else?
> > >
> > > Thanks,
> > > Gaurav
> > >
>
>

--
Mahim Mishra
Graduate Student, CS Deptt,      8203 Wean Hall, CMU
School of Computer Science,      ph  :+1-412-268-3562
Carnegie Mellon University.      www :http://www.cs.cmu.edu/~mahim

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.5 : 01/30/03 EST