sane-project-website/old-archive/1997-10/0110.html

269 wiersze
9.6 KiB
HTML

<!-- received="Sun Oct 19 13:19:57 1997 MST" -->
<!-- sent="Sun, 19 Oct 1997 22:20:46 +0200 (MET DST)" -->
<!-- name="Guido Muesch" -->
<!-- email="odiug@faho.rwth-aachen.de" -->
<!-- subject="sane-0.66 BW QuickCam fixes" -->
<!-- id="199710192020.WAA00581@darkstar.faho.rwth-aachen.de" -->
<!-- inreplyto="" -->
<title>sane-devel: sane-0.66 BW QuickCam fixes</title>
<h1>sane-0.66 BW QuickCam fixes</h1>
<b>Guido Muesch</b> (<a href="mailto:odiug@faho.rwth-aachen.de"><i>odiug@faho.rwth-aachen.de</i></a>)<br>
<i>Sun, 19 Oct 1997 22:20:46 +0200 (MET DST)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#110">[ date ]</a><a href="index.html#110">[ thread ]</a><a href="subject.html#110">[ subject ]</a><a href="author.html#110">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0111.html">David Mosberger-Tang: "Re: Mustek600IICD / lost lines"</a>
<li> <b>Previous message:</b> <a href="0109.html">Peter Daum: "Re: Incompatible gtk versions (Re: umax-backend)"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
---2105130183-269167349-877292452=:579<br>
Content-Type: TEXT/plain; CHARSET=US-ASCII<br>
<p>
Hi guys and girls<br>
<p>
Having some spare time, I looked again into the Qcam code and made some<br>
fixes to get the BW QuickCam working better.<br>
<p>
The BW Qcam did only return one frame when operated from xcam. Somehow<br>
the Cam needs to be resetted before getting a new frame. So I put a<br>
qc_reset in sane_start for non-color Qcams. I remember that I read<br>
something about a "special" treatment to get continous frames from a BW<br>
Qcam. Is resetting it the right thing to do before getting the next<br>
frame or was there any other magic? Unfortunatly I do not have the<br>
specs.<br>
<p>
There was also the problem of getting a "diagonal" picture with some<br>
resolutions and bitdepths. I chose the "normal" framesize for BW<br>
Qcams (320x240) and get a right picture with nearly every transferscale<br>
and bitdepth (except bidir and a bitdepth of 4). I still do not<br>
understand why this is so. When trying different framesizes you can<br>
observe that some will result in diagonal pictures and some not. By now<br>
I did not see any major differences between SANE and qcam-0.91 which I<br>
use for comparison, but I try to investigate this further.<br>
<p>
There is also one problem left when changing the bitdepth when xcam is<br>
constantly aquiring images. After changing the bitdepth you just get<br>
snow or it hangs.<br>
<p>
I also disabled some options which are not supported by the BW Qcam and<br>
chose some better default values for brightness, whitebalance and<br>
contrast on the BW Qcam.<br>
<p>
Hoping this makes the BW Qcam a bit more usable with SANE I attached<br>
the diffs for qcam.h and qcam.c.<br>
<p>
Ciao<br>
Guido<br>
<pre>
--
__/\ ______________________________________ Guido Muesch
\/ <a href="mailto:odiug@faho.rwth-aachen.de">odiug@faho.rwth-aachen.de</a>
<p>
---2105130183-269167349-877292452=:579
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Description: qcam.h.diff
<p>
*** qcam.h.orig Fri Oct 17 14:37:22 1997
--- qcam.h Fri Oct 17 14:42:54 1997
***************
*** 76,88 ****
QC_SET_NUM_V = 17,
QC_SET_NUM_H = 19,
QC_SEND_VERSION = 23,
- QC_BW_SET_CONTRAST = 25,
- QC_BW_AUTO_ADJUST_OFFSET = 27,
QC_SET_BLACK = 29,
QC_SET_WHITE = 31,
- QC_BW_GET_OFFSET = 33,
QC_SET_SATURATION = 35,
- QC_SET_CONTRAST = 37,
QC_SEND_STATUS = 41,
QC_SET_SPEED = 45
}
--- 76,84 ----
<p>
---2105130183-269167349-877292452=:579
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Description: qcam.c.diff
<p>
*** qcam.c.orig Fri Oct 17 14:37:16 1997
--- qcam.c Fri Oct 17 23:25:36 1997
***************
*** 191,196 ****
--- 191,201 ----
{1, 499, 2}, /* billion mode */
};
+ static const SANE_Range bw_x_range = {0, 334, 2};
+ static const SANE_Range odd_bw_x_range = {1, 335, 2};
+ static const SANE_Range bw_y_range = {0, 241, 1};
+ static const SANE_Range odd_bw_y_range = {1, 242, 1};
+
#ifdef __linux__
#if __GNU_LIBRARY__ - 0 &lt; 6
***************
*** 799,806 ****
--- 804,813 ----
/* Don't do this in sane_start() since there may be a long
timespan between it and the first sane_read(), which would
result in poor images. */
+
qc_send (q, QC_SEND_VIDEO_FRAME);
qc_send (q, req.mode);
+
if (req.despeckle
&amp;&amp; (!extra || buffer_size &lt; num_bytes || buffer_size &gt;= 2*num_bytes))
***************
*** 1185,1192 ****
s-&gt;opt[OPT_DEPTH].type = SANE_TYPE_INT;
s-&gt;opt[OPT_DEPTH].unit = SANE_UNIT_BIT;
s-&gt;opt[OPT_DEPTH].constraint_type = SANE_CONSTRAINT_WORD_LIST;
! s-&gt;opt[OPT_DEPTH].constraint.word_list = mono_depth_list;
! s-&gt;val[OPT_DEPTH].w = mono_depth_list[NELEMS(mono_depth_list) - 1];
/* test */
s-&gt;opt[OPT_TEST].name = "test-image";
--- 1192,1199 ----
s-&gt;opt[OPT_DEPTH].type = SANE_TYPE_INT;
s-&gt;opt[OPT_DEPTH].unit = SANE_UNIT_BIT;
s-&gt;opt[OPT_DEPTH].constraint_type = SANE_CONSTRAINT_WORD_LIST;
! s-&gt;opt[OPT_DEPTH].constraint.word_list = color_depth_list;
! s-&gt;val[OPT_DEPTH].w = color_depth_list[NELEMS(color_depth_list) - 1];
/* test */
s-&gt;opt[OPT_TEST].name = "test-image";
***************
*** 1203,1209 ****
s-&gt;opt[OPT_GEOMETRY_GROUP].title = "Geometry";
s-&gt;opt[OPT_GEOMETRY_GROUP].desc = "";
s-&gt;opt[OPT_GEOMETRY_GROUP].type = SANE_TYPE_GROUP;
! s-&gt;opt[OPT_GEOMETRY_GROUP].cap = SANE_CAP_ADVANCED;
s-&gt;opt[OPT_GEOMETRY_GROUP].constraint_type = SANE_CONSTRAINT_NONE;
/* top-left x */
--- 1210,1216 ----
s-&gt;opt[OPT_GEOMETRY_GROUP].title = "Geometry";
s-&gt;opt[OPT_GEOMETRY_GROUP].desc = "";
s-&gt;opt[OPT_GEOMETRY_GROUP].type = SANE_TYPE_GROUP;
! s-&gt;opt[OPT_GEOMETRY_GROUP].cap = 0; /*SANE_CAP_ADVANCED;*/
s-&gt;opt[OPT_GEOMETRY_GROUP].constraint_type = SANE_CONSTRAINT_NONE;
/* top-left x */
***************
*** 1461,1472 ****
if (s-&gt;hw-&gt;version == QC_COLOR)
{
s-&gt;opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
- s-&gt;opt[OPT_DEPTH].constraint.word_list = color_depth_list;
- s-&gt;val[OPT_DEPTH].w = color_depth_list[NELEMS(color_depth_list) - 1];
}
else
{
s-&gt;opt[OPT_DESPECKLE].cap |= SANE_CAP_INACTIVE;
}
/* insert newly opened handle into list of open handles: */
--- 1468,1502 ----
if (s-&gt;hw-&gt;version == QC_COLOR)
{
s-&gt;opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
}
+ /* Black level, Hue and Saturation are things the b&amp;w cameras know nothing
+ about.
+ Despeckle might be useful, but this code seems to work for
+ color cameras only right now
+ The framesize seems to work better in these ranges.*/
else
{
s-&gt;opt[OPT_DESPECKLE].cap |= SANE_CAP_INACTIVE;
+ s-&gt;opt[OPT_BLACK_LEVEL].cap |= SANE_CAP_INACTIVE;
+ s-&gt;opt[OPT_HUE].cap |= SANE_CAP_INACTIVE;
+ s-&gt;opt[OPT_SATURATION].cap |= SANE_CAP_INACTIVE;
+ s-&gt;opt[OPT_RESOLUTION].cap |= SANE_CAP_INACTIVE;
+ s-&gt;opt[OPT_TEST].cap |= SANE_CAP_INACTIVE;
+
+ s-&gt;opt[OPT_DEPTH].constraint.word_list = mono_depth_list;
+ s-&gt;val[OPT_DEPTH].w = mono_depth_list[NELEMS(mono_depth_list) - 1];
+ s-&gt;opt[OPT_TL_X].constraint.range = &amp;bw_x_range;
+ s-&gt;val[OPT_TL_X].w = 14;
+ s-&gt;opt[OPT_TL_Y].constraint.range = &amp;bw_y_range;
+ s-&gt;val[OPT_TL_Y].w = 0;
+ s-&gt;opt[OPT_BR_X].constraint.range = &amp;odd_bw_x_range;
+ s-&gt;val[OPT_BR_X].w = 333;
+ s-&gt;opt[OPT_BR_Y].constraint.range = &amp;odd_bw_y_range;
+ s-&gt;val[OPT_BR_Y].w = 239;
+
+ s-&gt;val[OPT_BRIGHTNESS].w = 170;
+ s-&gt;val[OPT_CONTRAST].w = 150;
+ s-&gt;val[OPT_WHITE_LEVEL].w = 150;
}
/* insert newly opened handle into list of open handles: */
***************
*** 1813,1823 ****
}
}
if (s-&gt;value_changed &amp; (1 &lt;&lt; OPT_CONTRAST))
{
s-&gt;value_changed &amp;= ~(1 &lt;&lt; OPT_CONTRAST);
qc_send (q, ((q-&gt;version == QC_COLOR)
! ? QC_SET_CONTRAST : QC_BW_SET_CONTRAST));
qc_send (q, s-&gt;val[OPT_CONTRAST].w);
}
--- 1843,1856 ----
}
}
+ if (q-&gt;version != QC_COLOR)
+ qc_reset(q);
+
if (s-&gt;value_changed &amp; (1 &lt;&lt; OPT_CONTRAST))
{
s-&gt;value_changed &amp;= ~(1 &lt;&lt; OPT_CONTRAST);
qc_send (q, ((q-&gt;version == QC_COLOR)
! ? QC_COL_SET_CONTRAST : QC_MONO_SET_CONTRAST));
qc_send (q, s-&gt;val[OPT_CONTRAST].w);
}
***************
*** 1860,1866 ****
}
else
{
! val = undecimated_width * 4;
val2 =
((q-&gt;port_mode == QC_BIDIR) ? 24 : 8) * s-&gt;val[OPT_XFER_SCALE].w;
}
--- 1893,1899 ----
}
else
{
! val = undecimated_width * s-&gt;val[OPT_DEPTH].w;
val2 =
((q-&gt;port_mode == QC_BIDIR) ? 24 : 8) * s-&gt;val[OPT_XFER_SCALE].w;
}
<p>
---2105130183-269167349-877292452=:579--
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0111.html">David Mosberger-Tang: "Re: Mustek600IICD / lost lines"</a>
<li> <b>Previous message:</b> <a href="0109.html">Peter Daum: "Re: Incompatible gtk versions (Re: umax-backend)"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>