Open GoogleCodeExporter opened 9 years ago
I'm sorry, but you are correct :-)
The random-access access to a pixel of CVImage is currently only for 8-bit RGB
images. This sucks... I know. It's just want I needed up until now.
I am planning to revise this and find a nice way to allow access to all types
of images.
I am not sure what would be the best tactic to do this... Perhaps subclass
CVImage to
accommodate different types of images, such that the this[] operator will
reflect the
type of image created... We need to figure out the nicest way to factory this
image
object.
Ideas are most welcome!!!
Original comment by elad.ben...@gmail.com
on 7 Mar 2007 at 5:11
OK, perhaps I could solve all my problems if I just could initialize a CVImage
from a
Bitmap :-)
Sorry
Original comment by iza...@gmail.com
on 7 Mar 2007 at 5:15
ALL WORKING !!
I have solved my problem !!!
I haven't modified the library, of course (I know very little about C++) :-)
I just initialized a CVImage like a Bitmap, and I have obtained the same result
as it
was a gray-scale image. It's a quite stupid code, but it can be helpful for
begginers:
static public CVImage matrix2CVImage(Matrix m)
{
int fil = m.RowCount;
int col = m.ColumnCount;
int i, j;
CVImage img = new CVImage(col, fil, CVDepth.Depth8U, 1);
for (i = 0; i < fil; i++)
{
for (j = 0; j < col; j++)
{
int iR = (int) m[i, j];
int iG = (int) m[i, j];
int iB = (int) m[i, j];
CVRgbPixel pix = new CVRgbPixel(Color.FromArgb(iR, iG, iB));
img[i, j] = pix;
}
}
return img;
}
If we want to create a CVImage from some gray-scale values, we can use that
method.
Notice this:
CVImage img = new CVImage(col, fil, CVDepth.Depth8U, 1);
It's a gray-scale image.
If you are asking about the Matrix class, look at the MathNet project:
http://www.cdrnet.net/projects/nmath/
There we can find a lot of useful classes for mathematics, and easy Matrix
manipulation (all from .NET). If we combine it with OpenCVDotNet... x-)
Good work!
Original comment by iza...@gmail.com
on 7 Mar 2007 at 5:53
Original issue reported on code.google.com by
iza...@gmail.com
on 7 Mar 2007 at 4:38