<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.elphel.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Fthiery</id>
	<title>ElphelWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.elphel.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Fthiery"/>
	<link rel="alternate" type="text/html" href="https://wiki.elphel.com/wiki/Special:Contributions/Fthiery"/>
	<updated>2026-08-01T12:53:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Wishlist&amp;diff=4817</id>
		<title>Wishlist</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Wishlist&amp;diff=4817"/>
		<updated>2010-10-04T17:00:01Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* C API */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As user I noticed some things I wanted to have on my camera, I hope anyone that has ideas can add them here. &lt;br /&gt;
What features are you waiting for?&lt;br /&gt;
What software components are still missing that you cannot live without?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Software==&lt;br /&gt;
If a project has been completed just add the developer that did it, or is busy on it.&lt;br /&gt;
=== Sensor ===&lt;br /&gt;
* [[Dead/Hot pixel correction]]&lt;br /&gt;
&lt;br /&gt;
=== Compass ===&lt;br /&gt;
* &#039;&#039;&#039;DONE&#039;&#039;&#039; [[Implement calibration]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
* [[DHCP (timeouted) and DNS-SD]]&lt;br /&gt;
* [[GigaBit ethernet]]&lt;br /&gt;
* Zeroconf (Rendezvous) for LAN device announcing&lt;br /&gt;
* [[http://opensoundcontrol.org OpenSound Control]] [[http://en.wikipedia.org/wiki/OpenSound_Control  OpenSound Control on wikipedia]], [[http://www.linuxjournal.com/content/introduction-osc introduction to OSC on linuxjournal]]&lt;br /&gt;
* CF Ethernet card support [[http://www.pocketpcfaq.com/peripherals/cfethernet.htm CF 10/100 Ethernet cards list]]&lt;br /&gt;
* CF WiFi card support [[http://www.google.ru/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=1&amp;amp;url=http%3A%2F%2Fwww.linksys.com%2Fservlet%2FSatellite%3Fchildpagename%3DUS%252FLayout%26packedargs%3Dc%253DL_Product_C2%2526cid%253D1115416826419%26pagename%3DLinksys%252FCommon%252FVisitorWrapper&amp;amp;ei=2CkjSb2pB4PG0gXtx92CAg&amp;amp;usg=AFQjCNFGaaRKL7uwQ7UNQQsxbdf9mrsoeA&amp;amp;sig2=wYBsCu8pfOyTJt57UW57EA WCF54G]]&lt;br /&gt;
* CF USB card support [[http://www.twin-paradox.com/SEPDA.html SolarExpress]] [[http://www.ratocsystems.com/english/products/CFU2U.html CFU2]]&lt;br /&gt;
* External USB Display support [http://gizmodo.com/5116061/mimo-um+750-7+inch-usb-display-lightning-review Mimo UM-750 7-inch].&lt;br /&gt;
&lt;br /&gt;
=== Fastest Boot ===&lt;br /&gt;
* [[Fast Boot]]&lt;br /&gt;
&lt;br /&gt;
=== APIs ===&lt;br /&gt;
* [[C API]]&lt;br /&gt;
* [[SOAP API]]&lt;br /&gt;
&lt;br /&gt;
=== UDMA support ===&lt;br /&gt;
* Enable [[UDMA]] in the Axis kernel. Needed to support most fast CF cards, will also boost speed on SATA.&lt;br /&gt;
&lt;br /&gt;
=== Debayer Algorithmn ===&lt;br /&gt;
* Higher image quality debayer algorithmn FPGA implementation -&amp;gt; [http://scien.stanford.edu/class/psych221/projects/99/tingchen/algodep/vargra.html VNG]&lt;br /&gt;
&lt;br /&gt;
==Hardware==&lt;br /&gt;
What will the next elphel camera most likely entitled &#039;&#039;&#039;Elphel 373&#039;&#039;&#039; be like?&lt;br /&gt;
&lt;br /&gt;
===Power Supply===&lt;br /&gt;
* optional 5-36V supply over additional jack [http://focus.ti.com/docs/prod/folders/print/tps5430.html DC/DC] [http://focus.ti.com/docs/prod/folders/print/tps23750.html POE] [http://www.rlocman.ru/review/article.html?di=52247 TI Article]&lt;br /&gt;
&lt;br /&gt;
===Sensor===&lt;br /&gt;
* Vignetting hardware correction&lt;br /&gt;
* Lens distortion hardware correction&lt;br /&gt;
* Fixed pattern noise (FPN) correction&lt;br /&gt;
* Flash mode for rolling shutter&lt;br /&gt;
* Make image thumbnails (binning 8x8 from DCT[0,0] data)&lt;br /&gt;
&#039;&#039;&#039;Position adjustment&#039;&#039;&#039;&lt;br /&gt;
*initial focus/pan/tilt sensor adjustment&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interface&#039;&#039;&#039;&lt;br /&gt;
*group VLDS pairs in flexible cable from sensor to board&lt;br /&gt;
*[[CCD table|CCD sensors]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sony IMX021&#039;&#039;&#039;&lt;br /&gt;
*designed for DSLRs (possibly the sensor used in Nikon D300 / D90)&lt;br /&gt;
*12.4 MPix&lt;br /&gt;
*5.5 µm pixel&lt;br /&gt;
*0.18 µm technology&lt;br /&gt;
*28mm x 22.2 mm APS-C sized 1.8&amp;quot; image area (28.4 mm diagonal)&lt;br /&gt;
*12 bit column ADC&lt;br /&gt;
*10.4 fps in 12.4 MPix mode&lt;br /&gt;
*on-chip noise reduction&lt;br /&gt;
*parallel A/D for every pixel coloumn&lt;br /&gt;
&lt;br /&gt;
===CPU===&lt;br /&gt;
*USB2.0 Support&lt;br /&gt;
&lt;br /&gt;
===External data sensors support===&lt;br /&gt;
*&#039;&#039;&#039;DONE&#039;&#039;&#039; GPS&lt;br /&gt;
*&#039;&#039;&#039;DONE&#039;&#039;&#039; Compass&lt;br /&gt;
*Dry contact (simply switch event)&lt;br /&gt;
*&#039;&#039;&#039;DONE&#039;&#039;&#039; RFID&lt;br /&gt;
*Proximity&lt;br /&gt;
*Environment sensors: Temperature/Humidity/Pressure/Illuminance/Loudness/.. [http://www.catnip.co.uk/wx Open Weather], [http://www.sciproj.com/FeaturedVendorProduct.aspx?uid=1208227 EL-USB-RT], [http://www.raphnet.net/electronique/usbtenki/index_en.php USBTenki], [http://www.sparkfun.com/commerce/product_info.php?products_id=8311 USB Weather Board], [http://www.farnell.com/datasheets/129494.pdf CY3271-EXP1 (PSoC Environmental Sensing Kit)]&lt;br /&gt;
*Futaba servo captute interface (for robots)&lt;br /&gt;
&lt;br /&gt;
===External control===&lt;br /&gt;
*USB2.0 Support&lt;br /&gt;
*Futaba servo control interface (for robots) [http://www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/CategoryID/35/List/0/Level/a/ProductID/346/Default.aspx?SortField=ProductName%2CProductName PSC] [http://www.endurance-rc.com/pantilt.html Pan&amp;amp;Tilt] [http://www.openservo.com/ OpenServo] [http://www.embeddedrelated.com/usenet/embedded/show/46581-1.php Verilog solution] [http://www.sparkfun.com/commerce/product_info.php?products_id=8897 Polulu]&lt;br /&gt;
*Relay control&lt;br /&gt;
*CAN support [http://www.qprotos.com/quickcan.htm quickcan] [http://www.gridconnect.com/usbcanin.html USB CAN Adapter]&lt;br /&gt;
*DMX512 support [http://en.wikipedia.org/wiki/DMX-512 DMX512]&lt;br /&gt;
*Secure Digital support [http://www.delkin.com/products/adapters/sd-to-cf/sd-to-cf.html CF-SD]&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Wishlist&amp;diff=4816</id>
		<title>Wishlist</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Wishlist&amp;diff=4816"/>
		<updated>2010-10-04T16:58:57Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* Networking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As user I noticed some things I wanted to have on my camera, I hope anyone that has ideas can add them here. &lt;br /&gt;
What features are you waiting for?&lt;br /&gt;
What software components are still missing that you cannot live without?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Software==&lt;br /&gt;
If a project has been completed just add the developer that did it, or is busy on it.&lt;br /&gt;
=== Sensor ===&lt;br /&gt;
* [[Dead/Hot pixel correction]]&lt;br /&gt;
&lt;br /&gt;
=== Compass ===&lt;br /&gt;
* &#039;&#039;&#039;DONE&#039;&#039;&#039; [[Implement calibration]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
* [[DHCP (timeouted) and DNS-SD]]&lt;br /&gt;
* [[GigaBit ethernet]]&lt;br /&gt;
* Zeroconf (Rendezvous) for LAN device announcing&lt;br /&gt;
* [[http://opensoundcontrol.org OpenSound Control]] [[http://en.wikipedia.org/wiki/OpenSound_Control  OpenSound Control on wikipedia]], [[http://www.linuxjournal.com/content/introduction-osc introduction to OSC on linuxjournal]]&lt;br /&gt;
* CF Ethernet card support [[http://www.pocketpcfaq.com/peripherals/cfethernet.htm CF 10/100 Ethernet cards list]]&lt;br /&gt;
* CF WiFi card support [[http://www.google.ru/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=1&amp;amp;url=http%3A%2F%2Fwww.linksys.com%2Fservlet%2FSatellite%3Fchildpagename%3DUS%252FLayout%26packedargs%3Dc%253DL_Product_C2%2526cid%253D1115416826419%26pagename%3DLinksys%252FCommon%252FVisitorWrapper&amp;amp;ei=2CkjSb2pB4PG0gXtx92CAg&amp;amp;usg=AFQjCNFGaaRKL7uwQ7UNQQsxbdf9mrsoeA&amp;amp;sig2=wYBsCu8pfOyTJt57UW57EA WCF54G]]&lt;br /&gt;
* CF USB card support [[http://www.twin-paradox.com/SEPDA.html SolarExpress]] [[http://www.ratocsystems.com/english/products/CFU2U.html CFU2]]&lt;br /&gt;
* External USB Display support [http://gizmodo.com/5116061/mimo-um+750-7+inch-usb-display-lightning-review Mimo UM-750 7-inch].&lt;br /&gt;
&lt;br /&gt;
=== Fastest Boot ===&lt;br /&gt;
* [[Fast Boot]]&lt;br /&gt;
&lt;br /&gt;
=== C API ===&lt;br /&gt;
* [[C API]]&lt;br /&gt;
&lt;br /&gt;
=== UDMA support ===&lt;br /&gt;
* Enable [[UDMA]] in the Axis kernel. Needed to support most fast CF cards, will also boost speed on SATA.&lt;br /&gt;
&lt;br /&gt;
=== Debayer Algorithmn ===&lt;br /&gt;
* Higher image quality debayer algorithmn FPGA implementation -&amp;gt; [http://scien.stanford.edu/class/psych221/projects/99/tingchen/algodep/vargra.html VNG]&lt;br /&gt;
&lt;br /&gt;
==Hardware==&lt;br /&gt;
What will the next elphel camera most likely entitled &#039;&#039;&#039;Elphel 373&#039;&#039;&#039; be like?&lt;br /&gt;
&lt;br /&gt;
===Power Supply===&lt;br /&gt;
* optional 5-36V supply over additional jack [http://focus.ti.com/docs/prod/folders/print/tps5430.html DC/DC] [http://focus.ti.com/docs/prod/folders/print/tps23750.html POE] [http://www.rlocman.ru/review/article.html?di=52247 TI Article]&lt;br /&gt;
&lt;br /&gt;
===Sensor===&lt;br /&gt;
* Vignetting hardware correction&lt;br /&gt;
* Lens distortion hardware correction&lt;br /&gt;
* Fixed pattern noise (FPN) correction&lt;br /&gt;
* Flash mode for rolling shutter&lt;br /&gt;
* Make image thumbnails (binning 8x8 from DCT[0,0] data)&lt;br /&gt;
&#039;&#039;&#039;Position adjustment&#039;&#039;&#039;&lt;br /&gt;
*initial focus/pan/tilt sensor adjustment&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interface&#039;&#039;&#039;&lt;br /&gt;
*group VLDS pairs in flexible cable from sensor to board&lt;br /&gt;
*[[CCD table|CCD sensors]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sony IMX021&#039;&#039;&#039;&lt;br /&gt;
*designed for DSLRs (possibly the sensor used in Nikon D300 / D90)&lt;br /&gt;
*12.4 MPix&lt;br /&gt;
*5.5 µm pixel&lt;br /&gt;
*0.18 µm technology&lt;br /&gt;
*28mm x 22.2 mm APS-C sized 1.8&amp;quot; image area (28.4 mm diagonal)&lt;br /&gt;
*12 bit column ADC&lt;br /&gt;
*10.4 fps in 12.4 MPix mode&lt;br /&gt;
*on-chip noise reduction&lt;br /&gt;
*parallel A/D for every pixel coloumn&lt;br /&gt;
&lt;br /&gt;
===CPU===&lt;br /&gt;
*USB2.0 Support&lt;br /&gt;
&lt;br /&gt;
===External data sensors support===&lt;br /&gt;
*&#039;&#039;&#039;DONE&#039;&#039;&#039; GPS&lt;br /&gt;
*&#039;&#039;&#039;DONE&#039;&#039;&#039; Compass&lt;br /&gt;
*Dry contact (simply switch event)&lt;br /&gt;
*&#039;&#039;&#039;DONE&#039;&#039;&#039; RFID&lt;br /&gt;
*Proximity&lt;br /&gt;
*Environment sensors: Temperature/Humidity/Pressure/Illuminance/Loudness/.. [http://www.catnip.co.uk/wx Open Weather], [http://www.sciproj.com/FeaturedVendorProduct.aspx?uid=1208227 EL-USB-RT], [http://www.raphnet.net/electronique/usbtenki/index_en.php USBTenki], [http://www.sparkfun.com/commerce/product_info.php?products_id=8311 USB Weather Board], [http://www.farnell.com/datasheets/129494.pdf CY3271-EXP1 (PSoC Environmental Sensing Kit)]&lt;br /&gt;
*Futaba servo captute interface (for robots)&lt;br /&gt;
&lt;br /&gt;
===External control===&lt;br /&gt;
*USB2.0 Support&lt;br /&gt;
*Futaba servo control interface (for robots) [http://www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/CategoryID/35/List/0/Level/a/ProductID/346/Default.aspx?SortField=ProductName%2CProductName PSC] [http://www.endurance-rc.com/pantilt.html Pan&amp;amp;Tilt] [http://www.openservo.com/ OpenServo] [http://www.embeddedrelated.com/usenet/embedded/show/46581-1.php Verilog solution] [http://www.sparkfun.com/commerce/product_info.php?products_id=8897 Polulu]&lt;br /&gt;
*Relay control&lt;br /&gt;
*CAN support [http://www.qprotos.com/quickcan.htm quickcan] [http://www.gridconnect.com/usbcanin.html USB CAN Adapter]&lt;br /&gt;
*DMX512 support [http://en.wikipedia.org/wiki/DMX-512 DMX512]&lt;br /&gt;
*Secure Digital support [http://www.delkin.com/products/adapters/sd-to-cf/sd-to-cf.html CF-SD]&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=JP4&amp;diff=5099</id>
		<title>JP4</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=JP4&amp;diff=5099"/>
		<updated>2009-12-31T14:37:11Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* GStreamer plugins for Elphel JP4 image and video processing  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note: the JP4 mode described here is referred as &amp;quot;JP46&amp;quot; in current 8.0 firwmare&lt;br /&gt;
&lt;br /&gt;
== JP4 Format ==&lt;br /&gt;
&lt;br /&gt;
We have added a special JP4 mode that bypasses the Demosaic in the FPGA and provides an image with pixels in each 16x16 macroblock that are rearranged to separate Bayer colors in individual 8x8 blocks, then encoded as monochrome. [[Demosaic_on_client_side|Demosaic]] will be applied during post-processing on the host PC. This section describe different algorithms and implementations used to provide this functionality.&lt;br /&gt;
&lt;br /&gt;
Main goals:&lt;br /&gt;
 - compression speed improvement&lt;br /&gt;
 - possibility to obtain more high quality image (near to RAW)&lt;br /&gt;
 - drasticaly lowering data size&lt;br /&gt;
== Different JP4 Modes in 8.X Software ==&lt;br /&gt;
only modes 0-2 can be processed with standard libjpeg:                 &lt;br /&gt;
*0 - mono6, monochrome (color YCbCr 4:2:0 with zeroed out color componets)                 &lt;br /&gt;
*1 - color, YCbCr 4:2:0, 3x3 pixels                 &lt;br /&gt;
*2 - jp46 - original JP4 (from 7.X software), encoded as 4:2:0 with zeroed color components                 &lt;br /&gt;
*3 - jp46dc, modified jp46 so each color component uses individual DC diffenential encoding                 &lt;br /&gt;
*4 - reserved for color with 5x5 conversion (not yet implemented)&lt;br /&gt;
*5 - jp4 with ommitted color components (4:0:0)&lt;br /&gt;
*6 - jp4dc, similar to jp46dc encoded as 4:0:0&lt;br /&gt;
*7 - jp4diff, differential where (R-G), G, (G2-G) and (B-G) components are encoded as 4:0:0&lt;br /&gt;
*8 - jp4hdr, (R-G), G, G2,(B-G) are encoded so G2 can be used with high gain                 &lt;br /&gt;
*9 - jp4fiff2, (R-G)/2, G,(G2-G)/2, (B-G)/2 to avoid possible overflow in compressed values                &lt;br /&gt;
*10 - jp4hdr2, (R-G)/2, G,G2,(B-G)/2                &lt;br /&gt;
*14 - mono,  monochrome with ommitted color components (4:0:0)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[JP4 HDR]] ===&lt;br /&gt;
Bayer pattern look like this&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
 |-&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+RGGB&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |}&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+BGGR&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |}&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+GBRG&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |}&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+GRBG&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |}&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
The remark: all kinds of bayer patterns can be received from initial RGGB by flipping on X and/or Y.&lt;br /&gt;
&lt;br /&gt;
Some sensors have possibility to set independed scale to G1 and G2.&lt;br /&gt;
Considering that the accessible optics does not give the full permission of a sensor resolution, it [[JP4_HDR|can be]] used for increase in a dynamic range of a image sensor.&lt;br /&gt;
&lt;br /&gt;
== JP4 processing on the host ==&lt;br /&gt;
&lt;br /&gt;
=== JP4 image decoding in MATLAB ===&lt;br /&gt;
JP4 format can be easy manipulated by [http://www.mathworks.com/matlabcentral/fileexchange/22144 MATLAB] [[Image:Fruits_jp4.jpg|thumb|JP4 image]]&lt;br /&gt;
&lt;br /&gt;
1. Read image&lt;br /&gt;
 I=imread(&#039;hdr02.jp4&#039;); %read JP4 file like JPEG&lt;br /&gt;
   ,or online grab image from http like this:&lt;br /&gt;
 I=imread(&#039;http://community.elphel.com/pictures/jp4.jpg&#039;);&lt;br /&gt;
   ,or cam:&lt;br /&gt;
 I=imread(&#039;http://cam_ip/bimg&#039;); %get online buffered image from cam&lt;br /&gt;
&lt;br /&gt;
 I=I(:,:,1);            %strip color data&lt;br /&gt;
2. Remove block grouping[[Image:Fruits_jp4_deblocked.jpg|thumb|Bayer CFA encoded image]]&lt;br /&gt;
&amp;lt;code matlab&amp;gt;&lt;br /&gt;
 II=deblock16x16(I);    %deblock image&lt;br /&gt;
&lt;br /&gt;
 %file deblock16x16.m&lt;br /&gt;
 function y=deblock16x16(I)&lt;br /&gt;
 y0=uint8(zeros(size(I)));&lt;br /&gt;
 for x=1:16:size(I,1)&lt;br /&gt;
   for y=1:16:size(I,2)&lt;br /&gt;
     blk16=I(x:x+15,y:y+15);&lt;br /&gt;
       for dx=0:7&lt;br /&gt;
         for dy=0:7&lt;br /&gt;
           y0(x+2*dx  ,y+2*dy)   = blk16(dx+1,dy+1);&lt;br /&gt;
           y0(x+2*dx+1,y+2*dy)   = blk16(dx+9,dy+1);&lt;br /&gt;
           y0(x+2*dx  ,y+2*dy+1) = blk16(dx+1,dy+9);&lt;br /&gt;
           y0(x+2*dx+1,y+2*dy+1) = blk16(dx+9,dy+9);&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 y=y0;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
2. Demosaic image (Decode from Bayer CFA (Color Filter Array) encoded image)[[Image:Fruits_jp4_debayered.jpg|thumb|Decoded image]]&lt;br /&gt;
 J=demosaic(II,&#039;gbrg&#039;);&lt;br /&gt;
3. Show image&lt;br /&gt;
 imshow(J);&lt;br /&gt;
&lt;br /&gt;
=== JP4 to DNG image conversion ===&lt;br /&gt;
&lt;br /&gt;
Credits: Dave Coffin&lt;br /&gt;
&lt;br /&gt;
This Linux command line tool allows conversion of JP4 files into a DNGs that dcraw and Adobe Photoshop can open.&lt;br /&gt;
&lt;br /&gt;
Download [http://community.elphel.com/files/jp4/tiff-3.8.2.tar.gz LibTIFF v3.8.2] a&lt;br /&gt;
*extract the tar.gz (this should create a new folder called &amp;quot;tiff-3.8.2&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Apply [http://community.elphel.com/files/jp4/libtiff.patch this patch]: in terminal (first cd to path of libtiff.patch):&lt;br /&gt;
 patch -p0 &amp;lt; libtiff.patch  &lt;br /&gt;
&lt;br /&gt;
build LibTIFF:&lt;br /&gt;
&lt;br /&gt;
 cd tiff-3.8.2&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Then compile [http://community.elphel.com/files/jp4/elphel_dng.c this C program] with:&lt;br /&gt;
 gcc -o elphel_dng elphel_dng.c -ltiff&lt;br /&gt;
&lt;br /&gt;
Then use the created application:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./elphel_dng &amp;quot;gamma&amp;quot; &amp;quot;input.jpg&amp;quot; &amp;quot;output.dng&amp;quot;&lt;br /&gt;
 Example: ./elphel_dng 100 example_JP4.jpeg example.dng&lt;br /&gt;
&lt;br /&gt;
=== JP4 video stream decoding using MPlayer ===&lt;br /&gt;
JP4 stream can be decoded by MPlayer.&lt;br /&gt;
Use this [[http://community.elphel.com/files/mplayer/debayer.diff this patch]]&lt;br /&gt;
  patch . -p0 &amp;lt; debayer.diff in the mplayer source dir&lt;br /&gt;
&lt;br /&gt;
Or download win32 binaries from sourceforge.&lt;br /&gt;
 usage example: mplayer.exe test.avi -vf demosaic=deblock=1:method=7:pattern=3  -vo gl&lt;br /&gt;
 mencoder example: mencoder.exe test.avi -ovc lavc -lavcopts vcodec=mjpeg -o output.avi -vf demosaic=deblock=1:method=1,scale&lt;br /&gt;
&lt;br /&gt;
 Debayer ([[Demosaic_on_client_side|Demosaic]]) algorithm variants provided by libdc1394:&lt;br /&gt;
 - Nearest Neighbor : OpenCV library&lt;br /&gt;
 - Bilinear         : OpenCV library&lt;br /&gt;
 - HQLinear         : High-Quality Linear Interpolation For Demosaicing Of Bayer-Patterned&lt;br /&gt;
                      Color Images, by Henrique S. Malvar, Li-wei He, and Ross Cutler,    &lt;br /&gt;
                         in Proceedings of the ICASSP&#039;04 Conference.                      &lt;br /&gt;
 - Edge Sense II    : Laroche, Claude A. &amp;quot;Apparatus and method for adaptively interpolating&lt;br /&gt;
                      a full color image utilizing chrominance gradients&amp;quot;                  &lt;br /&gt;
                         U.S. Patent 5,373,322. Based on the code found on the website     &lt;br /&gt;
                      http://www-ise.stanford.edu/~tingchen/ Converted to C and adapted to &lt;br /&gt;
                      all four elementary patterns.                                        &lt;br /&gt;
 - Downsample       : &amp;quot;Known to the Ancients&amp;quot;                                              &lt;br /&gt;
 - Simple           : Implemented from the information found in the manual of Allied Vision&lt;br /&gt;
                      Technologies (AVT) cameras.                                          &lt;br /&gt;
 - VNG              : Variable Number of Gradients, a method described in                  &lt;br /&gt;
                      http://www-ise.stanford.edu/~tingchen/algodep/vargra.html            &lt;br /&gt;
                      Sources import from DCRAW by Frederic Devernay. DCRAW is a RAW       &lt;br /&gt;
                      converter program by Dave Coffin. URL:                               &lt;br /&gt;
                      http://www.cybercom.net/~dcoffin/dcraw/                              &lt;br /&gt;
 - AHD              : Adaptive Homogeneity-Directed Demosaicing Algorithm, by K. Hirakawa  &lt;br /&gt;
                      and T.W. Parks, IEEE Transactions on Image Processing, Vol. 14, Nr. 3,&lt;br /&gt;
                      March 2005, pp. 360 - 369.&lt;br /&gt;
&lt;br /&gt;
 Pattern codes: pattern=0..3 -&amp;gt; [RGGB, BGGR, GBRG, GRBG]&lt;br /&gt;
&lt;br /&gt;
===  Avisynth plugin for JP4 processing ===&lt;br /&gt;
[http://avisynth.org/mediawiki/Main_Page Avisynth plugin] also available&lt;br /&gt;
&lt;br /&gt;
AVS script example:&lt;br /&gt;
 LoadCPlugin(&amp;quot;jp4.dll&amp;quot;)&lt;br /&gt;
 DirectShowSource(&amp;quot;test.avi&amp;quot;)&lt;br /&gt;
 JP4(&amp;quot;AHD&amp;quot;,&amp;quot;RGGB&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== GStreamer plugins for Elphel JP4 image and video processing ===&lt;br /&gt;
[http://code.google.com/p/gst-plugins-elphel/ This project] supported by http://ubicast.eu hosts Elphel related gstreamer components, so far: &lt;br /&gt;
&lt;br /&gt;
* the jp462bayer plugin converts color and monochrome JP46 Elphel bitstreams to Bayer raw format. In the future, it might support other JP4 modes (JP4, JP4-HDR, ...)&lt;br /&gt;
* bayer2rgb2 converts raw Bayer streams to RGB images &lt;br /&gt;
&lt;br /&gt;
==== jp462bayer: JP4 to Bayer ====&lt;br /&gt;
&lt;br /&gt;
After jpegdec, re-arranges the pixels in Bayer format.&lt;br /&gt;
&lt;br /&gt;
==== bayer2rgb2: debayer ====&lt;br /&gt;
&lt;br /&gt;
It offers the same features as the legacy bayer2rgb, but by wrapping Libdc1394&#039;s debayering algorithms you can choose the interpoloation algorithm between : simple, bilinear, hqlinear, downsample, edgesense, vng, ahd, nearest &lt;br /&gt;
&lt;br /&gt;
==== Example pipelines ====&lt;br /&gt;
&lt;br /&gt;
 gst-launch-0.10 rtspsrc location=rtsp://elphel:554 protocols=0x00000001 ! rtpjpegdepay ! jpegdec ! \&lt;br /&gt;
 queue ! jp462bayer ! queue ! bayer2rgb2 ! queue ! ffmpegcolorspace ! videorate ! &amp;quot;video/x-raw-yuv, \&lt;br /&gt;
 format=(fourcc)I420, width=(int)1920, height=(int)1088, framerate=(fraction)25/1&amp;quot; ! xvimagesink sync=false max-lateness=-1&lt;br /&gt;
&lt;br /&gt;
== Demosaicing/debayering links ==&lt;br /&gt;
&lt;br /&gt;
[http://scien.stanford.edu/class/psych221/projects/99/tingchen A Study of Spatial Color Interpolation Algorithms for Single-Detector Digital Cameras. Ting Chen / Stanford University]&lt;br /&gt;
&lt;br /&gt;
Source code:&lt;br /&gt;
 [http://sourceforge.net/projects/elynx eLynx Image Processing SDK and Lab]&lt;br /&gt;
 [http://libdc1394.git.sourceforge.net/git/gitweb.cgi?p=libdc1394;a=blob;f=libdc1394/dc1394/bayer.c;hb=HEAD libdc1394]&lt;br /&gt;
 [http://graphics.cs.williams.edu/papers/BayerJGT09 Efficient, high-quality Bayer demosaic filtering on GPUs]&lt;br /&gt;
 http://svn2.assembla.com/svn/ge/libgedrawing/trunk/src/ImageBayer.cpp&lt;br /&gt;
&lt;br /&gt;
Example files:&lt;br /&gt;
* [http://community.elphel.com/files/jp4/example_JP4.jpeg Example JP4]&lt;br /&gt;
* [http://community.elphel.com/files/jp4/example_flipped.dng Example DNG]&lt;br /&gt;
* [http://community.elphel.com/files/jp4/example_converted.jpg Example JPG (converted)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
&lt;br /&gt;
* [[Demosaic on client side]]&lt;br /&gt;
* [http://linuxdevices.com/articles/AT4187053130.html Elphel camera under the hood: from Verilog to PHP - on LinuxDevices.com]&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Demosaic_on_client_side&amp;diff=3890</id>
		<title>Demosaic on client side</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Demosaic_on_client_side&amp;diff=3890"/>
		<updated>2009-07-23T15:04:12Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* Gstreamer implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
Our actual FPGA code on the camera use very simple algorithm to calculate YCbCr from the Bayer pixels. It use just 3x3 block of neighbors. The other point is that this algorithm is time consuming and with the 5MPix sensor the FPGA became the bottleneck. So we have added a special [[JP4]] mode what bypass the Demosaic in the FPGA and provide an image with pixels in each 16x16 macroblock what are rearranged to separate Bayer colors in individual 8x8 blocks, then encoded as monochrome. Demosaic will be applied during post-processing on the host PC. This page describe different algorithms and implementations used to provide this functionality.&lt;br /&gt;
&lt;br /&gt;
Cf. wikipedia for more info on [http://en.wikipedia.org/wiki/Demosaicing Demosaicing].&lt;br /&gt;
&lt;br /&gt;
= Working with RAW image data =&lt;br /&gt;
There actually already is a workflow to get RAW image data from the elphel camera and demosaic/postprocess on a computer.&lt;br /&gt;
&lt;br /&gt;
* Step 1: Use the JP4 encoded jpg output on a camera&lt;br /&gt;
* Step 2: We need to build a modified dcraw under linux to read our image: For the unexperience linux user this can be quite a challenge (at least it had been for me) I used Ubuntu 7.10 and first had to acquire the &amp;quot;build-essential&amp;quot; package via synaptic package manager. From the dcraw website grab [http://www.cybercom.net/~dcoffin/dcraw/elphel_dng.c elphel_dng.c] and [http://dl.maptools.org/dl/libtiff/tiff-3.8.2.tar.gz LibTIFF v3.8.2] as well as a [http://www.cybercom.net/~dcoffin/dcraw/libtiff.patch patch]. Unpack the LibTiff tar.gz and we have all files together. Apply the patch (the command is &amp;quot;patch -p1 &amp;lt; libtiff.patch&amp;quot;). This will do some minor changes in the source code. Now go into the libtiff directory and execute &amp;quot;./configure&amp;quot;. If successful do &amp;quot;make&amp;quot; and then &amp;quot;make install&amp;quot; (I had to do &amp;quot;sudo su&amp;quot; first to be able to install anything as root). I had special trouble because I am running a 64bit system and &amp;quot;make&amp;quot; complained about static and dynamic libraries and that I should compile tif_stream.o with -fPIC parameter. Nothing of the suggested worked. In the end I did it with a &amp;quot;make clean&amp;quot; (don&#039;t ask me why!). After libtiff was successfully built we need to compile the elphel_dng.c. Everything you need to know is already written into the header of that source file: &amp;quot;gcc -o elphel_dng elphel_dng.c -O4 -Wall -lm -ljpeg -ltiff&amp;quot; and you have an executable.&lt;br /&gt;
* Step 3: We use the executable we just built to convert our jp4 jpeg. Usage &amp;quot;./elphel_dng gamma infile outfile&amp;quot; for example &amp;quot;./elphel_dng 100 jp4.jpg test.dng&amp;quot;&lt;br /&gt;
* Done. You should now have a DNG that you can load in any raw editing software like photoshop, lightroom, aperture or GUIs for dcraw.&lt;br /&gt;
&lt;br /&gt;
= Comparing different demosaicing algorithms  =&lt;br /&gt;
&lt;br /&gt;
There are many different ways to reconstruct (or at least try to) all pixels color channels from Bayer pattern data.&lt;br /&gt;
&lt;br /&gt;
Here is a side by side comparison:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:1080 jpg 99.jpeg|thumb|JPEG processed within a Elphel 353 at 99% JPEG quality - camera uses the Variable Number of Gradients algorithm]]||[[Image:1080 UFRaw Bilinear.jpg|thumb|UFRaw processed using the fast &amp;quot;Bilinear&amp;quot; algorithm]]||[[Image:1080 UFRaw VNG.jpg|thumb|UFRaw processed using the VNG (Variable Number of Gradients interpolation) algorithm]]||[[Image:1080 UFRaw PPG.jpg|thumb|UFRaw processed using the PPG (Patterned Pixel Grouping) algorithm]]||[[Image:1080 UFRaw AHD.jpg|thumb|UFRaw processed using the AHD (Adaptive Homogeneity-Directed interpolation) algorithm]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All RAW file were generated by converting JP4 encoded JPEGs to DNG and where then processed in UFRaw. (sorry for the slight difference in brightness and saturation, it was the closest I could get in UFRaw to what the camera does internally)&lt;br /&gt;
&lt;br /&gt;
Detail comparison:&lt;br /&gt;
&lt;br /&gt;
[[Image:Detail01.jpg|300% Zoom]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Detail02.jpg|300% Zoom]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Conclusion&#039;&#039;&#039;:&lt;br /&gt;
For some reason the elphel internal algorithm which should actually be identical to the UFRaw VNG falls behind all UFRaw created methods. The elphel processed image lacks sharpness and richness in detail and is similar to the bilinear interpolation. AHD, VNG and PPG algorithms processed in UFRaw show very sharp results with clearly more visible details. Noise is a bit stronger in luminosity but less in chroma. VNG has less color artifacts than AHD and PPG.&lt;br /&gt;
&lt;br /&gt;
= The goals =&lt;br /&gt;
==Video processing==&lt;br /&gt;
Next step is to be able to embed this algorithm into MPlayer, VLC, FFmpeg and GSTreamer for video processing. The goal is to get the maximum sensor FPS processed on the computer. So at 5MPix it&#039;s 15 FPS, at 1920x1088 it&#039;s 30 FPS.&lt;br /&gt;
&lt;br /&gt;
= Algorithm =&lt;br /&gt;
== Existing ==&lt;br /&gt;
There are several algorithms that provide good results with less artifacts (see Wikipedia article) and these detailed descriptions:&lt;br /&gt;
* [http://scien.stanford.edu/class/psych221/projects/99/tingchen/algodep/vargra.html Variable Number of Gradients]&lt;br /&gt;
* [http://web.cecs.pdx.edu/~cklin/demosaic/ Pixel Grouping]&lt;br /&gt;
* [http://www.dei.unipd.it/~menond/pub/dfapd/dfapd.html Demosaicing with Directional Filtering and a Posteriori Decision]&lt;br /&gt;
&lt;br /&gt;
== Implemented ==&lt;br /&gt;
We actually did implement the Variable Number of Gradients algorithm.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Several implementation with different numbers of software &amp;amp; hardware dependencies are possible.&lt;br /&gt;
&lt;br /&gt;
== OpenCV implementation ==&lt;br /&gt;
&lt;br /&gt;
== libjpeg implementation ==&lt;br /&gt;
&lt;br /&gt;
== Gstreamer implementation ==&lt;br /&gt;
&lt;br /&gt;
Gstreamer already offers:&lt;br /&gt;
* a jpegdec element&lt;br /&gt;
* a [http://webcvs.freedesktop.org/gstreamer/gst-plugins-bad/gst/bayer/gstbayer2rgb.c?view=markup bayer2rgb] component, which decodes raw camera bayer (fourcc BA81) to RGB&lt;br /&gt;
&lt;br /&gt;
An implementation based on bayer2rgb is currently in development, using [http://libdc1394.git.sourceforge.net/git/gitweb.cgi?p=libdc1394;a=blob;f=libdc1394/dc1394/bayer.c;hb=HEAD libdc1394] for the demosaicing&lt;br /&gt;
&lt;br /&gt;
It will be used like this: &lt;br /&gt;
gst-launch rtspsrc ... ! rtpjpegdepay ! jpegdec ! bayer2rgb2 jp4=true ! xvimagesink&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Demosaic_on_client_side&amp;diff=3889</id>
		<title>Demosaic on client side</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Demosaic_on_client_side&amp;diff=3889"/>
		<updated>2009-07-23T14:50:50Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* Gstreamer implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
Our actual FPGA code on the camera use very simple algorithm to calculate YCbCr from the Bayer pixels. It use just 3x3 block of neighbors. The other point is that this algorithm is time consuming and with the 5MPix sensor the FPGA became the bottleneck. So we have added a special [[JP4]] mode what bypass the Demosaic in the FPGA and provide an image with pixels in each 16x16 macroblock what are rearranged to separate Bayer colors in individual 8x8 blocks, then encoded as monochrome. Demosaic will be applied during post-processing on the host PC. This page describe different algorithms and implementations used to provide this functionality.&lt;br /&gt;
&lt;br /&gt;
Cf. wikipedia for more info on [http://en.wikipedia.org/wiki/Demosaicing Demosaicing].&lt;br /&gt;
&lt;br /&gt;
= Working with RAW image data =&lt;br /&gt;
There actually already is a workflow to get RAW image data from the elphel camera and demosaic/postprocess on a computer.&lt;br /&gt;
&lt;br /&gt;
* Step 1: Use the JP4 encoded jpg output on a camera&lt;br /&gt;
* Step 2: We need to build a modified dcraw under linux to read our image: For the unexperience linux user this can be quite a challenge (at least it had been for me) I used Ubuntu 7.10 and first had to acquire the &amp;quot;build-essential&amp;quot; package via synaptic package manager. From the dcraw website grab [http://www.cybercom.net/~dcoffin/dcraw/elphel_dng.c elphel_dng.c] and [http://dl.maptools.org/dl/libtiff/tiff-3.8.2.tar.gz LibTIFF v3.8.2] as well as a [http://www.cybercom.net/~dcoffin/dcraw/libtiff.patch patch]. Unpack the LibTiff tar.gz and we have all files together. Apply the patch (the command is &amp;quot;patch -p1 &amp;lt; libtiff.patch&amp;quot;). This will do some minor changes in the source code. Now go into the libtiff directory and execute &amp;quot;./configure&amp;quot;. If successful do &amp;quot;make&amp;quot; and then &amp;quot;make install&amp;quot; (I had to do &amp;quot;sudo su&amp;quot; first to be able to install anything as root). I had special trouble because I am running a 64bit system and &amp;quot;make&amp;quot; complained about static and dynamic libraries and that I should compile tif_stream.o with -fPIC parameter. Nothing of the suggested worked. In the end I did it with a &amp;quot;make clean&amp;quot; (don&#039;t ask me why!). After libtiff was successfully built we need to compile the elphel_dng.c. Everything you need to know is already written into the header of that source file: &amp;quot;gcc -o elphel_dng elphel_dng.c -O4 -Wall -lm -ljpeg -ltiff&amp;quot; and you have an executable.&lt;br /&gt;
* Step 3: We use the executable we just built to convert our jp4 jpeg. Usage &amp;quot;./elphel_dng gamma infile outfile&amp;quot; for example &amp;quot;./elphel_dng 100 jp4.jpg test.dng&amp;quot;&lt;br /&gt;
* Done. You should now have a DNG that you can load in any raw editing software like photoshop, lightroom, aperture or GUIs for dcraw.&lt;br /&gt;
&lt;br /&gt;
= Comparing different demosaicing algorithms  =&lt;br /&gt;
&lt;br /&gt;
There are many different ways to reconstruct (or at least try to) all pixels color channels from Bayer pattern data.&lt;br /&gt;
&lt;br /&gt;
Here is a side by side comparison:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:1080 jpg 99.jpeg|thumb|JPEG processed within a Elphel 353 at 99% JPEG quality - camera uses the Variable Number of Gradients algorithm]]||[[Image:1080 UFRaw Bilinear.jpg|thumb|UFRaw processed using the fast &amp;quot;Bilinear&amp;quot; algorithm]]||[[Image:1080 UFRaw VNG.jpg|thumb|UFRaw processed using the VNG (Variable Number of Gradients interpolation) algorithm]]||[[Image:1080 UFRaw PPG.jpg|thumb|UFRaw processed using the PPG (Patterned Pixel Grouping) algorithm]]||[[Image:1080 UFRaw AHD.jpg|thumb|UFRaw processed using the AHD (Adaptive Homogeneity-Directed interpolation) algorithm]]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All RAW file were generated by converting JP4 encoded JPEGs to DNG and where then processed in UFRaw. (sorry for the slight difference in brightness and saturation, it was the closest I could get in UFRaw to what the camera does internally)&lt;br /&gt;
&lt;br /&gt;
Detail comparison:&lt;br /&gt;
&lt;br /&gt;
[[Image:Detail01.jpg|300% Zoom]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Detail02.jpg|300% Zoom]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Conclusion&#039;&#039;&#039;:&lt;br /&gt;
For some reason the elphel internal algorithm which should actually be identical to the UFRaw VNG falls behind all UFRaw created methods. The elphel processed image lacks sharpness and richness in detail and is similar to the bilinear interpolation. AHD, VNG and PPG algorithms processed in UFRaw show very sharp results with clearly more visible details. Noise is a bit stronger in luminosity but less in chroma. VNG has less color artifacts than AHD and PPG.&lt;br /&gt;
&lt;br /&gt;
= The goals =&lt;br /&gt;
==Video processing==&lt;br /&gt;
Next step is to be able to embed this algorithm into MPlayer, VLC, FFmpeg and GSTreamer for video processing. The goal is to get the maximum sensor FPS processed on the computer. So at 5MPix it&#039;s 15 FPS, at 1920x1088 it&#039;s 30 FPS.&lt;br /&gt;
&lt;br /&gt;
= Algorithm =&lt;br /&gt;
== Existing ==&lt;br /&gt;
There are several algorithms that provide good results with less artifacts (see Wikipedia article) and these detailed descriptions:&lt;br /&gt;
* [http://scien.stanford.edu/class/psych221/projects/99/tingchen/algodep/vargra.html Variable Number of Gradients]&lt;br /&gt;
* [http://web.cecs.pdx.edu/~cklin/demosaic/ Pixel Grouping]&lt;br /&gt;
* [http://www.dei.unipd.it/~menond/pub/dfapd/dfapd.html Demosaicing with Directional Filtering and a Posteriori Decision]&lt;br /&gt;
&lt;br /&gt;
== Implemented ==&lt;br /&gt;
We actually did implement the Variable Number of Gradients algorithm.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Several implementation with different numbers of software &amp;amp; hardware dependencies are possible.&lt;br /&gt;
&lt;br /&gt;
== OpenCV implementation ==&lt;br /&gt;
&lt;br /&gt;
== libjpeg implementation ==&lt;br /&gt;
&lt;br /&gt;
== Gstreamer implementation ==&lt;br /&gt;
&lt;br /&gt;
Gstreamer already offers:&lt;br /&gt;
* a jpegdec element&lt;br /&gt;
* a [http://webcvs.freedesktop.org/gstreamer/gst-plugins-bad/gst/bayer/gstbayer2rgb.c?view=markup bayer2rgb] component, which decodes raw camera bayer (fourcc BA81) to RGB&lt;br /&gt;
&lt;br /&gt;
An implementation based on bayer2rgb is currently in development, using [http://libdc1394.git.sourceforge.net/git/gitweb.cgi?p=libdc1394;a=blob;f=libdc1394/dc1394/bayer.c;hb=HEAD libdc1394] for the demosaicing&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=JP4&amp;diff=5089</id>
		<title>JP4</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=JP4&amp;diff=5089"/>
		<updated>2009-07-23T14:39:43Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note: the JP4 mode described here is referred as &amp;quot;JP46&amp;quot; in current 8.0 firwmare&lt;br /&gt;
&lt;br /&gt;
== JP4 format ==&lt;br /&gt;
&lt;br /&gt;
So we have added a special JP4 mode that bypasses the Demosaic in the FPGA and provides an image with pixels in each 16x16 macroblock that are rearranged to separate Bayer colors in individual 8x8 blocks, then encoded as monochrome. [[Demosaic_on_client_side|Demosaic]] will be applied during post-processing on the host PC. This section describe different algorithms and implementations used to provide this functionality.&lt;br /&gt;
&lt;br /&gt;
Main goals:&lt;br /&gt;
 - compression speed improvement&lt;br /&gt;
 - possibility to obtain more high quality image (near to RAW)&lt;br /&gt;
 - drasticaly lowering data size&lt;br /&gt;
&lt;br /&gt;
== Image decoding ==&lt;br /&gt;
JP4 format can be easy manipulated by [http://www.mathworks.com/matlabcentral/fileexchange/22144 MATLAB] [[Image:Fruits_jp4.jpg|thumb|JP4 image]]&lt;br /&gt;
&lt;br /&gt;
1. Read image&lt;br /&gt;
 I=imread(&#039;hdr02.jp4&#039;); %read JP4 file like JPEG&lt;br /&gt;
   ,or online grab image from http like this:&lt;br /&gt;
 I=imread(&#039;http://community.elphel.com/pictures/jp4.jpg&#039;);&lt;br /&gt;
   ,or cam:&lt;br /&gt;
 I=imread(&#039;http://cam_ip/bimg&#039;); %get online buffered image from cam&lt;br /&gt;
&lt;br /&gt;
 I=I(:,:,1);            %strip color data&lt;br /&gt;
2. Remove block grouping[[Image:Fruits_jp4_deblocked.jpg|thumb|Bayer CFA encoded image]]&lt;br /&gt;
&amp;lt;code matlab&amp;gt;&lt;br /&gt;
 II=deblock16x16(I);    %deblock image&lt;br /&gt;
&lt;br /&gt;
 %file deblock16x16.m&lt;br /&gt;
 function y=deblock16x16(I)&lt;br /&gt;
 y0=uint8(zeros(size(I)));&lt;br /&gt;
 for x=1:16:size(I,1)&lt;br /&gt;
   for y=1:16:size(I,2)&lt;br /&gt;
     blk16=I(x:x+15,y:y+15);&lt;br /&gt;
       for dx=0:7&lt;br /&gt;
         for dy=0:7&lt;br /&gt;
           y0(x+2*dx  ,y+2*dy)   = blk16(dx+1,dy+1);&lt;br /&gt;
           y0(x+2*dx+1,y+2*dy)   = blk16(dx+9,dy+1);&lt;br /&gt;
           y0(x+2*dx  ,y+2*dy+1) = blk16(dx+1,dy+9);&lt;br /&gt;
           y0(x+2*dx+1,y+2*dy+1) = blk16(dx+9,dy+9);&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 y=y0;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
2. Demosaic image (Decode from Bayer CFA (Color Filter Array) encoded image)[[Image:Fruits_jp4_debayered.jpg|thumb|Decoded image]]&lt;br /&gt;
 J=demosaic(II,&#039;gbrg&#039;);&lt;br /&gt;
3. Show image&lt;br /&gt;
 imshow(J);&lt;br /&gt;
&lt;br /&gt;
== Stream decoding ==&lt;br /&gt;
JP4 stream can be decoded by mplayer.&lt;br /&gt;
Use [[http://community.elphel.com/files/mplayer/debayer.diff this patch]] for glue libdc1394 and MPlayer-1.0rc2 video filter frontend.&lt;br /&gt;
Or download win32 binaries from sourceforge.&lt;br /&gt;
 usage example: mplayer.exe test.avi -vf demosaic=deblock=1:method=7:pattern=3  -vo gl&lt;br /&gt;
 mencoder example: mencoder.exe test.avi -ovc lavc -lavcopts vcodec=mjpeg -o output.avi -vf demosaic=deblock=1:method=1,scale&lt;br /&gt;
&lt;br /&gt;
 Debayer ([[Demosaic_on_client_side|Demosaic]]) algorithm variants provided by libdc1394:&lt;br /&gt;
 - Nearest Neighbor : OpenCV library&lt;br /&gt;
 - Bilinear         : OpenCV library&lt;br /&gt;
 - HQLinear         : High-Quality Linear Interpolation For Demosaicing Of Bayer-Patterned&lt;br /&gt;
                      Color Images, by Henrique S. Malvar, Li-wei He, and Ross Cutler,    &lt;br /&gt;
                         in Proceedings of the ICASSP&#039;04 Conference.                      &lt;br /&gt;
 - Edge Sense II    : Laroche, Claude A. &amp;quot;Apparatus and method for adaptively interpolating&lt;br /&gt;
                      a full color image utilizing chrominance gradients&amp;quot;                  &lt;br /&gt;
                         U.S. Patent 5,373,322. Based on the code found on the website     &lt;br /&gt;
                      http://www-ise.stanford.edu/~tingchen/ Converted to C and adapted to &lt;br /&gt;
                      all four elementary patterns.                                        &lt;br /&gt;
 - Downsample       : &amp;quot;Known to the Ancients&amp;quot;                                              &lt;br /&gt;
 - Simple           : Implemented from the information found in the manual of Allied Vision&lt;br /&gt;
                      Technologies (AVT) cameras.                                          &lt;br /&gt;
 - VNG              : Variable Number of Gradients, a method described in                  &lt;br /&gt;
                      http://www-ise.stanford.edu/~tingchen/algodep/vargra.html            &lt;br /&gt;
                      Sources import from DCRAW by Frederic Devernay. DCRAW is a RAW       &lt;br /&gt;
                      converter program by Dave Coffin. URL:                               &lt;br /&gt;
                      http://www.cybercom.net/~dcoffin/dcraw/                              &lt;br /&gt;
 - AHD              : Adaptive Homogeneity-Directed Demosaicing Algorithm, by K. Hirakawa  &lt;br /&gt;
                      and T.W. Parks, IEEE Transactions on Image Processing, Vol. 14, Nr. 3,&lt;br /&gt;
                      March 2005, pp. 360 - 369.&lt;br /&gt;
&lt;br /&gt;
 Pattern codes: pattern=0..3 -&amp;gt; [RGGB, BGGR, GBRG, GRBG]&lt;br /&gt;
&lt;br /&gt;
== [[JP4 HDR]] ==&lt;br /&gt;
Bayer pattern look like this&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
 |-&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+RGGB&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |}&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+BGGR&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |}&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+GBRG&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;blue&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;red&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |}&lt;br /&gt;
 |&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;align=&amp;quot;center&amp;quot;&lt;br /&gt;
  |+GRBG&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B   || bgcolor=&amp;quot;green&amp;quot;|G2 || bgcolor=&amp;quot;red&amp;quot;|B&lt;br /&gt;
  |-&lt;br /&gt;
  | bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1 || bgcolor=&amp;quot;blue&amp;quot;|R    || bgcolor=&amp;quot;green&amp;quot;|G1&lt;br /&gt;
  |}&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
The remark: all kinds of bayer patterns can be received from initial RGGB by flipping on X and/or Y.&lt;br /&gt;
&lt;br /&gt;
Some sensors have possibility to set independed scale to G1 and G2.&lt;br /&gt;
Considering that the accessible optics does not give the full permission of a sensor resolution, it [[JP4_HDR|can be]] used for increase in a dynamic range of a image sensor.&lt;br /&gt;
&lt;br /&gt;
== [http://avisynth.org/mediawiki/Main_Page Avisynth] plugin ==&lt;br /&gt;
Avisynth plugin also available&lt;br /&gt;
&lt;br /&gt;
AVS script example:&lt;br /&gt;
 LoadCPlugin(&amp;quot;jp4.dll&amp;quot;)&lt;br /&gt;
 DirectShowSource(&amp;quot;test.avi&amp;quot;)&lt;br /&gt;
 JP4(&amp;quot;AHD&amp;quot;,&amp;quot;RGGB&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demosaic links ==&lt;br /&gt;
 http://sourceforge.net/projects/elynx/&lt;br /&gt;
 http://libdc1394.git.sourceforge.net/git/gitweb.cgi?p=libdc1394;a=blob;f=libdc1394/dc1394/bayer.c;hb=HEAD&lt;br /&gt;
 http://graphics.cs.williams.edu/papers/BayerJGT09/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JP4 to DNG conversion ==&lt;br /&gt;
&lt;br /&gt;
Credits: Dave Coffin&lt;br /&gt;
&lt;br /&gt;
This Linux comanndline tool allows conversion of JP4 files into a DNGs that dcraw and Adobe Photoshop can open.&lt;br /&gt;
&lt;br /&gt;
Download [http://community.elphel.com/files/jp4/tiff-3.8.2.tar.gz LibTIFF v3.8.2] a&lt;br /&gt;
*extract the tar.gz (this should create a new folder called &amp;quot;tiff-3.8.2&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Apply [http://community.elphel.com/files/jp4/libtiff.patch this patch]: in terminal (first cd to path of libtiff.patch):&lt;br /&gt;
 patch -p0 &amp;lt; libtiff.patch  &lt;br /&gt;
&lt;br /&gt;
build LibTIFF:&lt;br /&gt;
&lt;br /&gt;
 cd tiff-3.8.2&lt;br /&gt;
 ./configure&lt;br /&gt;
 make&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Then compile [http://community.elphel.com/files/jp4/elphel_dng.c this C program] with:&lt;br /&gt;
 gcc -o elphel_dng elphel_dng.c -ltiff&lt;br /&gt;
&lt;br /&gt;
Then use the created application:&lt;br /&gt;
&lt;br /&gt;
 Usage: ./elphel_dng &amp;quot;gamma&amp;quot; &amp;quot;input.jpg&amp;quot; &amp;quot;output.dng&amp;quot;&lt;br /&gt;
 Example: ./elphel_dng 100 example_JP4.jpeg example.dng&lt;br /&gt;
&lt;br /&gt;
Example files:&lt;br /&gt;
* [http://community.elphel.com/files/jp4/example_JP4.jpeg Example JP4]&lt;br /&gt;
* [http://community.elphel.com/files/jp4/example_flipped.dng Example DNG]&lt;br /&gt;
* [http://community.elphel.com/files/jp4/example_converted.jpg Example JPG (converted)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also:&lt;br /&gt;
&lt;br /&gt;
* [[Demosaic on client side]]&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5503</id>
		<title>Using gstreamer</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5503"/>
		<updated>2009-04-22T15:37:43Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gstreamer and live video processing over the network =&lt;br /&gt;
&lt;br /&gt;
Gstreamer is very suited to live video and audio processing, notably for live decoding/encoding, audio muxing.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
You will need&lt;br /&gt;
* a fairly recent gstreamer distribution, with the rtpjpegdepay plugin&lt;br /&gt;
* a relatively powerful computer to decode real time&lt;br /&gt;
&lt;br /&gt;
= Limitations =&lt;br /&gt;
&lt;br /&gt;
You will not (at this time) be able to decode the elphel 353 cameras on resolutions &amp;gt; 1920x1080 (which is the highest resolution you can reach with 25 fps anyway), because of the RTP payloading limits, with 25 fps anyway.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t, you&#039;ll just have to build it yourself (see [http://www.pitivi.org/wiki/GStreamer_CVS_Setup_Page this guide from PiTiVi]).&lt;br /&gt;
&lt;br /&gt;
= Tips =&lt;br /&gt;
&lt;br /&gt;
You won&#039;t get 25 fps if autoexposure is on and local brightness not high enough: the camera will automatically lower framerate for keeping clear picture. Either lighten up, or play with image settings (notably, gain).&lt;br /&gt;
&lt;br /&gt;
= Command line experiments =&lt;br /&gt;
&lt;br /&gt;
(Note: replace width and height accordingly to your camera setup and your computer&#039;s horsepower :p).&lt;br /&gt;
&lt;br /&gt;
== Displaying ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay !  queue ! jpegdec ! queue ! xvimagesink sync=false&lt;br /&gt;
&lt;br /&gt;
== Dumping ==&lt;br /&gt;
=== mjpeg dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! videorate ! capsfilter caps = &amp;quot;image/jpeg, framerate=(fraction)25/1, width=1024, height=768&amp;quot; ! queue ! matroskamux ! filesink location=/tmp/test.mkv&lt;br /&gt;
&lt;br /&gt;
=== YUV Dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! avimux ! filesink location=/tmp/test.avi&lt;br /&gt;
&lt;br /&gt;
== Dump transcoding example ==&lt;br /&gt;
&lt;br /&gt;
gst-launch filesrc location=test.mkv ! matroskademux ! queue ! jpegdec ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=test.ogg&lt;br /&gt;
&lt;br /&gt;
== Live encoding ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=/tmp/test1024.ogg&lt;br /&gt;
&lt;br /&gt;
I did some benchmarks; a Core 2 Quad Q6600 (2.4 Ghz) is not powerful enough for h264 encoding @fullHD resolution (using 4 treads).&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5502</id>
		<title>Using gstreamer</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5502"/>
		<updated>2009-03-12T00:22:26Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* Command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gstreamer and live video processing over the network =&lt;br /&gt;
&lt;br /&gt;
Gstreamer is very suited to live video and audio processing, notably for live decoding/encoding, audio muxing.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
You will need&lt;br /&gt;
* a fairly recent gstreamer distribution, with the rtpjpegdepay plugin&lt;br /&gt;
* a relatively powerful computer to decode real time&lt;br /&gt;
&lt;br /&gt;
= Limitations =&lt;br /&gt;
&lt;br /&gt;
You will not (at this time) be able to decode the elphel 353 cameras on resolutions &amp;gt; 1920x1080 (which is the highest resolution you can reach with 25 fps anyway), because of the RTP payloading limits, with 25 fps anyway.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t, you&#039;ll just have to build it yourself (see [http://www.pitivi.org/wiki/GStreamer_CVS_Setup_Page this guide from PiTiVi]).&lt;br /&gt;
&lt;br /&gt;
= Tips =&lt;br /&gt;
&lt;br /&gt;
You won&#039;t get 25 fps if autoexposure is on and local brightness not high enough: the camera will automatically lower framerate for keeping clear picture. Either lighten up, or play with image settings (notably, gain).&lt;br /&gt;
&lt;br /&gt;
= Command line experiments =&lt;br /&gt;
&lt;br /&gt;
(Note: replace width and height accordingly to your camera setup and your computer&#039;s horsepower :p).&lt;br /&gt;
&lt;br /&gt;
== Displaying ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay !  queue ! jpegdec ! queue ! xvimagesink sync=false&lt;br /&gt;
&lt;br /&gt;
== Dumping ==&lt;br /&gt;
=== mjpeg dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! videorate ! capsfilter caps = &amp;quot;image/jpeg, framerate=(fraction)25/1, width=1024, height=768&amp;quot; ! queue ! matroskamux ! filesink location=/tmp/test.mkv&lt;br /&gt;
&lt;br /&gt;
=== YUV Dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! avimux ! filesink location=/tmp/test.avi&lt;br /&gt;
&lt;br /&gt;
== Dump transcoding example ==&lt;br /&gt;
&lt;br /&gt;
gst-launch filesrc location=test.mkv ! matroskademux ! queue ! jpegdec ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=test.ogg&lt;br /&gt;
&lt;br /&gt;
== Live encoding ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=/tmp/test1024.ogg&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5501</id>
		<title>Using gstreamer</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5501"/>
		<updated>2009-03-12T00:21:59Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* Command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gstreamer and live video processing over the network =&lt;br /&gt;
&lt;br /&gt;
Gstreamer is very suited to live video and audio processing, notably for live decoding/encoding, audio muxing.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
You will need&lt;br /&gt;
* a fairly recent gstreamer distribution, with the rtpjpegdepay plugin&lt;br /&gt;
* a relatively powerful computer to decode real time&lt;br /&gt;
&lt;br /&gt;
= Limitations =&lt;br /&gt;
&lt;br /&gt;
You will not (at this time) be able to decode the elphel 353 cameras on resolutions &amp;gt; 1920x1080 (which is the highest resolution you can reach with 25 fps anyway), because of the RTP payloading limits, with 25 fps anyway.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t, you&#039;ll just have to build it yourself (see [http://www.pitivi.org/wiki/GStreamer_CVS_Setup_Page this guide from PiTiVi]).&lt;br /&gt;
&lt;br /&gt;
= Tips =&lt;br /&gt;
&lt;br /&gt;
You won&#039;t get 25 fps if autoexposure is on and local brightness not high enough: the camera will automatically lower framerate for keeping clear picture. Either lighten up, or play with image settings (notably, gain).&lt;br /&gt;
&lt;br /&gt;
= Command line =&lt;br /&gt;
== Displaying ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay !  queue ! jpegdec ! queue ! xvimagesink sync=false&lt;br /&gt;
&lt;br /&gt;
== Dumping ==&lt;br /&gt;
=== mjpeg dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! videorate ! capsfilter caps = &amp;quot;image/jpeg, framerate=(fraction)25/1, width=1024, height=768&amp;quot; ! queue ! matroskamux ! filesink location=/tmp/test.mkv&lt;br /&gt;
&lt;br /&gt;
=== YUV Dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! avimux ! filesink location=/tmp/test.avi&lt;br /&gt;
&lt;br /&gt;
== Dump transcoding example ==&lt;br /&gt;
&lt;br /&gt;
gst-launch filesrc location=test.mkv ! matroskademux ! queue ! jpegdec ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=test.ogg&lt;br /&gt;
&lt;br /&gt;
== Live encoding ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=/tmp/test1024.ogg&lt;br /&gt;
&lt;br /&gt;
(Note: replace width and height accordingly to your camera setup and your computer&#039;s horsepower :p).&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5500</id>
		<title>Using gstreamer</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5500"/>
		<updated>2009-03-12T00:17:26Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: /* Command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gstreamer and live video processing over the network =&lt;br /&gt;
&lt;br /&gt;
Gstreamer is very suited to live video and audio processing, notably for live decoding/encoding, audio muxing.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
You will need&lt;br /&gt;
* a fairly recent gstreamer distribution, with the rtpjpegdepay plugin&lt;br /&gt;
* a relatively powerful computer to decode real time&lt;br /&gt;
&lt;br /&gt;
= Limitations =&lt;br /&gt;
&lt;br /&gt;
You will not (at this time) be able to decode the elphel 353 cameras on resolutions &amp;gt; 1920x1080 (which is the highest resolution you can reach with 25 fps anyway), because of the RTP payloading limits, with 25 fps anyway.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t, you&#039;ll just have to build it yourself (see [http://www.pitivi.org/wiki/GStreamer_CVS_Setup_Page this guide from PiTiVi]).&lt;br /&gt;
&lt;br /&gt;
= Tips =&lt;br /&gt;
&lt;br /&gt;
You won&#039;t get 25 fps if autoexposure is on and local brightness not high enough: the camera will automatically lower framerate for keeping clear picture. Either lighten up, or play with image settings (notably, gain).&lt;br /&gt;
&lt;br /&gt;
= Command line =&lt;br /&gt;
== Displaying ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay !  queue ! jpegdec ! queue ! xvimagesink sync=false&lt;br /&gt;
&lt;br /&gt;
== Dumping ==&lt;br /&gt;
=== mjpeg dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! videorate ! capsfilter caps = &amp;quot;image/jpeg, framerate=(fraction)25/1, width=1024, height=768&amp;quot; ! queue ! matroskamux ! filesink location=/tmp/test.mkv&lt;br /&gt;
&lt;br /&gt;
=== YUV Dumping ===&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! avimux ! filesink location=/tmp/test.avi&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=/tmp/test1024.ogg&lt;br /&gt;
&lt;br /&gt;
(Note: replace width and height accordingly to your camera setup and your computer&#039;s horsepower :p).&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5499</id>
		<title>Using gstreamer</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Using_gstreamer&amp;diff=5499"/>
		<updated>2009-03-12T00:06:42Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Gstreamer and live video processing over the network =&lt;br /&gt;
&lt;br /&gt;
Gstreamer is very suited to live video and audio processing, notably for live decoding/encoding, audio muxing.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
&lt;br /&gt;
You will need&lt;br /&gt;
* a fairly recent gstreamer distribution, with the rtpjpegdepay plugin&lt;br /&gt;
* a relatively powerful computer to decode real time&lt;br /&gt;
&lt;br /&gt;
= Limitations =&lt;br /&gt;
&lt;br /&gt;
You will not (at this time) be able to decode the elphel 353 cameras on resolutions &amp;gt; 1920x1080 (which is the highest resolution you can reach with 25 fps anyway), because of the RTP payloading limits, with 25 fps anyway.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t, you&#039;ll just have to build it yourself (see [http://www.pitivi.org/wiki/GStreamer_CVS_Setup_Page this guide from PiTiVi]).&lt;br /&gt;
&lt;br /&gt;
= Tips =&lt;br /&gt;
&lt;br /&gt;
You won&#039;t get 25 fps if autoexposure is on and local brightness not high enough: the camera will automatically lower framerate for keeping clear picture. Either lighten up, or play with image settings (notably, gain).&lt;br /&gt;
&lt;br /&gt;
= Command line =&lt;br /&gt;
== Displaying ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay !  queue ! jpegdec ! queue ! xvimagesink sync=false&lt;br /&gt;
&lt;br /&gt;
== Encoding ==&lt;br /&gt;
&lt;br /&gt;
gst-launch -v rtspsrc location=rtsp://elphel:554 ! queue ! rtpjpegdepay ! queue ! jpegdec ! queue ! videorate ! capsfilter caps=&amp;quot;video/x-raw-yuv, format=(fourcc)I420, width=(int)1024, height=(int)768, framerate=(fraction)25/1&amp;quot; ! queue ! theoraenc bitrate=4000 ! queue ! oggmux ! filesink location=/tmp/test1024.ogg&lt;br /&gt;
&lt;br /&gt;
(Note: replace width and height accordingly to your camera setup and your computer&#039;s horsepower :p).&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Demosaic_on_client_side&amp;diff=3883</id>
		<title>Demosaic on client side</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Demosaic_on_client_side&amp;diff=3883"/>
		<updated>2008-08-14T13:26:36Z</updated>

		<summary type="html">&lt;p&gt;Fthiery: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
Our actual FPGA code on the camera use very simple algorithm to calculate YCbCr from the Bayer pixels. It use just 3x3 block of neighbors. The other point is that this algorithm is time consuming and with the 5MPix sensor the FPGA became the bottleneck. So we have added a special JP4 mode what bypass the Demosaic in the FPGA and provide an image with pixels in each 16x16 macroblock what are rearranged to separate Bayer colors in individual 8x8 blocks, then encoded as monochrome. Demosaic will be applied during post-processing on the host PC. This page describe different algorithms and implementations used to provide this functionality.&lt;br /&gt;
&lt;br /&gt;
Cf. wikipedia for more info on [http://en.wikipedia.org/wiki/Demosaicing Demosaicing].&lt;br /&gt;
&lt;br /&gt;
= Working with RAW image data =&lt;br /&gt;
There actually already is a workflow to get RAW image data from the elphel camera and demosaic/postprocess on a computer.&lt;br /&gt;
&lt;br /&gt;
* Step 1: Use the JP4 encoded jpg output on a camera&lt;br /&gt;
* Step 2: We need to build a modified dcraw under linux to read our image: For the unexperience linux user this can be quite a challenge (at least it had been for me) I used Ubuntu 7.10 and first had to acquire the &amp;quot;build-essential&amp;quot; package via synaptic package manager. From the dcraw website grab [http://www.cybercom.net/~dcoffin/dcraw/elphel_dng.c elphel_dng.c] and [http://dl.maptools.org/dl/libtiff/tiff-3.8.2.tar.gz LibTIFF v3.8.2] as well as a [http://www.cybercom.net/~dcoffin/dcraw/libtiff.patch patch]. Unpack the LibTiff tar.gz and we have all files together. Apply the patch (the command is &amp;quot;patch -p1 &amp;lt; libtiff.patch&amp;quot;). This will do some minor changes in the source code. Now go into the libtiff directory and execute &amp;quot;./configure&amp;quot;. If successful do &amp;quot;make&amp;quot; and then &amp;quot;make install&amp;quot; (I had to do &amp;quot;sudo su&amp;quot; first to be able to install anything as root). I had special trouble because I am running a 64bit system and &amp;quot;make&amp;quot; complained about static and dynamic libraries and that I should compile tif_stream.o with -fPIC parameter. Nothing of the suggested worked. In the end I did it with a &amp;quot;make clean&amp;quot; (don&#039;t ask me why!). After libtiff was successfully built we need to compile the elphel_dng.c. Everything you need to know is already written into the header of that source file: &amp;quot;gcc -o elphel_dng elphel_dng.c -O4 -Wall -lm -ljpeg -ltiff&amp;quot; and you have an executable.&lt;br /&gt;
* Step 3: We use the executable we just built to convert our jp4 jpeg. Usage &amp;quot;./elphel_dng gamma infile outfile&amp;quot; for example &amp;quot;./elphel_dng 100 jp4.jpg test.dng&amp;quot;&lt;br /&gt;
* Done. You should now have a DNG that you can load in any raw editing software like photoshop, lightroom, aperture or GUIs for dcraw.&lt;br /&gt;
&lt;br /&gt;
= The goals =&lt;br /&gt;
==Video processing==&lt;br /&gt;
Next step is to be able to embed this algorithm into MPlayer, VLC, FFmpeg and GSTreamer for video processing. The goal is to get the maximum sensor FPS processed on the computer. So at 5MPix it&#039;s 15 FPS, at 1920x1088 it&#039;s 30 FPS.&lt;br /&gt;
&lt;br /&gt;
= Algorithm =&lt;br /&gt;
== Existing ==&lt;br /&gt;
There are several algorithms that provide good results with less artifacts (see Wikipedia article) and these detailed descriptions:&lt;br /&gt;
* [http://scien.stanford.edu/class/psych221/projects/99/tingchen/algodep/vargra.html Variable Number of Gradients]&lt;br /&gt;
* [http://web.cecs.pdx.edu/~cklin/demosaic/ Pixel Grouping]&lt;br /&gt;
== Implemented ==&lt;br /&gt;
We actually did implement the Variable Number of Gradients algorithm.&lt;br /&gt;
&lt;br /&gt;
= Implementation =&lt;br /&gt;
Several implementation with different numbers of software &amp;amp; hardware dependencies are possible.&lt;br /&gt;
&lt;br /&gt;
== OpenCV implementation ==&lt;br /&gt;
&lt;br /&gt;
== libjpeg implementation ==&lt;br /&gt;
&lt;br /&gt;
== Gstreamer implementation ==&lt;br /&gt;
&lt;br /&gt;
Gstreamer already offers:&lt;br /&gt;
* a jpegdec element&lt;br /&gt;
* a [http://webcvs.freedesktop.org/gstreamer/gst-plugins-bad/gst/bayer/gstbayer2rgb.c?view=markup bayer2rgb] component, which decodes raw camera bayer (fourcc BA81) to RGB&lt;br /&gt;
&lt;br /&gt;
These may be starting points for implementing the forementioned method. However, it might be better to stick to the standards and provide raw data contained in e.g. YUV4MPEG4 container ?&lt;/div&gt;</summary>
		<author><name>Fthiery</name></author>
	</entry>
</feed>