Re: [sane-devel] Partial success using Iriscan Express 3

2023-09-20 Thread Stephane Louise
Hi,

Le mar. 19 sept. 2023 à 21:15, Ralph Little  a écrit :

> It would be cool to see some samples of that. It might be something that
> is easy to fix.
> Even better would be to create an issue on our GitLab backends page where
> the information you have supplied could be kept and progress tracked.
>
> Done. I hope this is the correct place. I had some issues with formatting
and # characters, so, something got lost in the post on gitlab. Hopefully
the portions of images are relevant.


> If you don't feel happy to do that then you could send some sample images
> to me personally and I will open the issue there. It also means that it
> doesn't get forgotten.
>
> Many thanks.

In the meantime, I played with python and openCV. I could make something
recognizable at least with the attached script. Nonetheless, integrating a
gradient is usually a bad idea because it is too sensitive to noise.

Cheers,

Stephane Louise
#import cv2, numpy and matplotlib libraries
import cv2
import numpy as np
import matplotlib.pyplot as plt
img=cv2.imread("color-ex.png")
#img=cv2.imread("partial.png")
#img= cv2.imread("extract.png")
print("Image size:",len(img),";",len(img[0]))
img2= img.copy()
mb=0
mg=0
mr=0
nb=0
for xi in img[0]:
	mb+= xi[0]
	mg+= xi[1]
	mr+= xi[2]
	nb+=1
print("Rm=",mr/nb," Gm=",mg/nb, "Bm=",mb/nb)
# means for each color channel
meanr= int(mr/nb)
meang= int(mg/nb)
meanb= int(mb/nb)
for xi in range(len(img)):
	curvalr= 0
	curvalg= 0
	curvalb= 0
	nb=0
	for yj in range(len(img[0])):
		pixel= img[xi,yj]
		# use the means to find the signed gradient value (don't ask about -0.75, it just works better experimentally, that's all)
		deltb= pixel[0]-meanb-0.75
		deltg= pixel[1]-meang-0.75
		deltr= pixel[2]-meanr-0.75
		# blue val managemen (integrate)t
		curvalb+= deltb
		if curvalb<0: 
			curvalb=0
		if curvalb>255:
			curvalb=255
		# green val management (integrate)
		curvalg+= deltg
		if curvalg<0: 
			curvalg=0
		if curvalg>255:
			curvalg=255
		# red val management (integrate)
		curvalr+= deltr
		if curvalr<0: 
			curvalr=0
		if curvalr>255:
			curvalr=255
		# some random correction of brightness to improve the output
		r= int(curvalr+30) if curvalr<225 else int(curvalr)
		g= int(curvalg+30) if curvalg<225 else int(curvalg)
		b= int(curvalb+30) if curvalb<225 else int(curvalb)
		# I don't know why the color channels are switched between red and blue
		img2[xi,yj]= (r, g, b)

# show result		
plt.imshow(img2)
 
#hold the window
plt.waitforbuttonpress()
plt.close('all')


Re: [sane-devel] Partial success using Iriscan Express 3

2023-09-19 Thread Ralph Little
Hi,
Thanks you for your report!

On Tue, Sep 19, 2023 at 2:34 AM Stephane Louise 
wrote:

> Hello,
>
> I wanted to report a partial success using Iriscan Express 3 scanner with
> sane (it is an oldy, but it was given to me so why not give it a try).
> For that, I probed the scanner using sane-find-scanner and scanimage -L,
> and was pretty confident that it was a gt6816 based scanner. Therefore I
> overrode the detection of the scanner to iriscan-express-2, in gt68xx.conf
> and it kind-of worked.
>
> The results: the commands are accurately given to the scanner, and it can
> scan in its highest resolution (600dpi) without crashing or endomaging the
> hardware. The main caveat is the fact that the output file is a horizontal
> gradient of the picture which is "not optimal" (looks like e.g. a Prewitt
> filter applied to the output). N.B: there are miss-alignments with lower
> resolutions also but for me it is still minor as long as I could make the
> native resolution work.
>

It would be cool to see some samples of that. It might be something that is
easy to fix.
Even better would be to create an issue on our GitLab backends page where
the information you have supplied could be kept and progress tracked.

If you don't feel happy to do that then you could send some sample images
to me personally and I will open the issue there. It also means that it
doesn't get forgotten.

Cheers,
Ralph


[sane-devel] Partial success using Iriscan Express 3

2023-09-19 Thread Stephane Louise
Hello,

I wanted to report a partial success using Iriscan Express 3 scanner with
sane (it is an oldy, but it was given to me so why not give it a try).
For that, I probed the scanner using sane-find-scanner and scanimage -L,
and was pretty confident that it was a gt6816 based scanner. Therefore I
overrode the detection of the scanner to iriscan-express-2, in gt68xx.conf
and it kind-of worked.

The results: the commands are accurately given to the scanner, and it can
scan in its highest resolution (600dpi) without crashing or endomaging the
hardware. The main caveat is the fact that the output file is a horizontal
gradient of the picture which is "not optimal" (looks like e.g. a Prewitt
filter applied to the output). N.B: there are miss-alignments with lower
resolutions also but for me it is still minor as long as I could make the
native resolution work.

Here are the information gathered by sane-find-scanner:
-

bLength   18
bDescriptorType   1
bcdUSB1.10
bDeviceClass  0
bDeviceSubClass   0
bDeviceProtocol   0
bMaxPacketSize0   64
idVendor  0x07B3
idProduct 0x0475
bcdDevice 5.01
iManufacturer 0 ()
iProduct  1 (600dpi USB Scanner)
iSerialNumber 0 ()
bNumConfigurations1
 
 bLength  9
 bDescriptorType  2
 wTotalLength 32
 bNumInterfaces   1
 bConfigurationValue  1
 iConfiguration   0 ()
 bmAttributes 160 (Remote Wakeup)
 MaxPower 500 mA
  
   
   bLength9
   bDescriptorType4
   bInterfaceNumber   0
   bAlternateSetting  0
   bNumEndpoints  2
   bInterfaceClass255
   bInterfaceSubClass 255
   bInterfaceProtocol 255
   iInterface 0 ()

bLength   7
bDescriptorType   5
bEndpointAddress  0x81 (in 0x01)
bmAttributes  2 (bulk)
wMaxPacketSize64
bInterval 0 ms
bRefresh  0
bSynchAddress 0

bLength   7
bDescriptorType   5
bEndpointAddress  0x02 (out 0x02)
bmAttributes  2 (bulk)
wMaxPacketSize64
bInterval 0 ms
bRefresh  0
bSynchAddress 0


checking for LM983[1,2,3] ...
this is not a LM983x (bNumEndpoints = 2)
checking for GT-6801 ...
this is not a GT-6801 (bDeviceClass = 0)
checking for GT-6816 ...


found possible USB scanner (vendor=0x07b3, product=0x0475 [600dpi USB
Scanner], chip=GT-6816) at libusb:001:038
--
and the override I utilized:

##
# Iriscan Express 3:
usb 0x07b3 0x0475
override "iriscan-express-2"

Let me know if  you want more information or if you think of something to
avoid the gradient effect.
(I can link to a test scan if you want but it is 105MB large)

Best regards,

Stéphane Louise