Greetings
I'm developing a GRASS C rotine to perform segmentation of images. As far as I can see, rotines like i.gensig and i.maxlik (or even r.example) usually gets a row and tthen process cell-by-cell. In this case, instead of loading only a row per image, I want to parse to the variable all the image. What C function shall I use?
Thanks
Antonio
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5546 (20101019) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
On Wed, October 20, 2010 10:13, António Rocha wrote:
Greetings
I'm developing a GRASS C rotine to perform segmentation of images. As
far as I can see, rotines like i.gensig and i.maxlik (or even r.example)
usually gets a row and tthen process cell-by-cell. In this case, instead
of loading only a row per image, I want to parse to the variable all the
image. What C function shall I use?
Don't have a direct answer, but have you looked at i.smap which also uses
some form of segmentation.
Moritz
Hello Morits
Thanks for the feedback. My problem is not a segmentation issue but a memory-allocation issue. I need to understand how in GRASS (C functions) I can allocate all pixels of a group images to an matrix (array of array) instead of just row-by-row (or column-by-column).
Does anyone has a clue?
Thanks
Antonio Rocha
Moritz Lennert wrote:
On Wed, October 20, 2010 10:13, António Rocha wrote:
Greetings
I'm developing a GRASS C rotine to perform segmentation of images. As
far as I can see, rotines like i.gensig and i.maxlik (or even r.example)
usually gets a row and tthen process cell-by-cell. In this case, instead
of loading only a row per image, I want to parse to the variable all the
image. What C function shall I use?
Don't have a direct answer, but have you looked at i.smap which also uses
some form of segmentation.
Moritz
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5548 (20101020) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5548 (20101020) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
António Rocha wrote:
Thanks for the feedback. My problem is not a segmentation issue but a
memory-allocation issue. I need to understand how in GRASS (C functions)
I can allocate all pixels of a group images to an matrix (array of
array) instead of just row-by-row (or column-by-column).
If you want the data interleaved by cell, you'll need to read a row
from each map then interleave the values yourself, e.g.
DCELL *row_buf = G_malloc(ncols * nbands * sizeof(DCELL));
for (row = 0; row < nrows; row++) {
for (band = 0; band < nbands; band++) {
G_get_d_raster_row(fds[band], bufs[band], row);
for (col = 0; col < ncols; col++)
row_buf[col * nbands + band] = bufs[band][col];
...
--
Glynn Clements <glynn@gclements.plus.com>