yes it is. I will try to check it again.
But AFAIK the fwrite and memory copy like this would be the same. On 2/3/09, m. allan noah <kitno455 at gmail.com> wrote: > So if you output the image from your code to disk as a pnm, instead of > handing it to opencv, does it look right? > > allan > > On Mon, Feb 2, 2009 at 9:03 PM, <dio.rahman at gmail.com> wrote: >> yeah -- it works; I use OpenCV to buffer the image -- with the size >> the same as the param.pixels_per_line * param.line (width * height) >> >> >> >> On 2/3/09, m. allan noah <kitno455 at gmail.com> wrote: >>> but when you use scanimage, it works? >>> >>> what image format are you saving it as? >>> >>> allan >>> >>> On Mon, Feb 2, 2009 at 8:41 PM, <dio.rahman at gmail.com> wrote: >>>> it's unsigned char >>>> (unsigned char * imageData) >>>> >>>> as you can see in the scanimage example, in each loop the sane_read >>>> will put the data into buffer with the specific buffer_size and actual >>>> data length (len). Hence, in each loop we have to copy that "partial >>>> image data" and assembly that data into the imageData. >>>> >>>> I also used that 'memcpy' >>>> >>>> while(status != SANE_STATUS_EOF){ >>>> status = sane_read (device, buffer, >>>> buffer_size, &len); >>>> >>>> memcpy(imageData+offset,buffer,len); >>>> offset+=len; >>>> >>>> ..... >>>> >>>> } >>>> >>>> and the problem still the same. >>>> >>>> Dio >>>> >>>> >>>> >>>> >>>> >>>> On 2/3/09, m. allan noah <kitno455 at gmail.com> wrote: >>>>> what data type is imageData? why not memcpy instead? >>>>> >>>>> allan >>>>> >>>>> On Mon, Feb 2, 2009 at 7:43 PM, <dio.rahman at gmail.com> wrote: >>>>>> Dear all, >>>>>> >>>>>> I have a basic question on buffering the image. >>>>>> >>>>>> Suppose I have an image data pointer * imageData; and I have image >>>>>> dimension information i.e. width and height. >>>>>> >>>>>> I need to copy the bytes read from the scanning process i.e. in the >>>>>> buffer (sane_read(buffer,buffer_size,&len)) to the image data. >>>>>> >>>>>> So, I do: >>>>>> >>>>>> for(int i=0;i<len;i++) >>>>>> *(imageData++) = buffer[i] >>>>>> until I found the SANE_STATUS_EOF >>>>>> >>>>>> but, when I showed the image, the pixel is not in the right order; >>>>>> Anyone can help me? >>>>>> >>>>>> Thanks >>>>>> >>>>>> Dio >>>>>> NOTE: I'm using CanonScan LiDE 50 -- grayscale image; and doing find >>>>>> with the scanimage example >>>>>> >>>>>> -- >>>>>> sane-devel mailing list: sane-devel at lists.alioth.debian.org >>>>>> http://lists.alioth.debian.org/mailman/listinfo/sane-devel >>>>>> Unsubscribe: Send mail with subject "unsubscribe your_password" >>>>>> to sane-devel-request at lists.alioth.debian.org >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> "The truth is an offense, but not a sin" >>>>> >>>> >>> >>> >>> >>> -- >>> "The truth is an offense, but not a sin" >>> >> > > > > -- > "The truth is an offense, but not a sin" >