Defective Pixel Replacement

The Pixel Replacement algorithm is based on a predefined bad pixel map (as an XML file), either supplied by the factory (file downloaded as Factory Map) or generated by the user (file uploaded as User Map 1). The number of bad pixel entries is limited and depends on the device. The following XML code sample forms the template for the user to build bad pixel maps.

User Defective Pixel Map XML File

The following example shows the required components of the defective pixel map file. Each bad pixel position (relative to the image origin which is the upper left corner), must be identified by the XML statement:

<DefectivePixel OffsetX="integer" OffsetY="integer"/> 

The pixel format (whether 8, 10, or 12-bit) is handled transparently, thus requires no special consideration by the user. The XML file identifies 4 bad pixels.

<?xmlversion="1.0"encoding="utf-8"?>
<!—Example User Defective Pixel Map->
<!—maximum 512 coordinates->
<!—filename: NanoExampleBadPixels.xml->
<Coordinates>
  <DefectivePixelOffsetX="100"OffsetY="0"/>
  <DefectivePixelOffsetX="28"OffsetY="345"/>
  <DefectivePixelOffsetX="468"OffsetY="50"/>
  <DefectivePixelOffsetX="800"OffsetY="600"/>
</Coordinates>

A sample editable defective pixel map replacement file is included with theGenie Nano 10G firmware .zip files, available for download from the https://www.teledynevisionsolutions.com/support/support-center/software-firmware-downloads/.

The algorithm descriptions that follow define the rules used by the Genie Nano 10G firmware to replace an identified bad pixel.

Monochrome Defective Pixel Replacement Algorithm

The replacement algorithm follows a few basic rules as defined below. The replacement of a defective pixel is done in the specified order. Note that pixels that are outside an ROI will not be considered to replace a defective pixel within an ROI.

  • Replace defective pixel (pix5) with the previous pixel (pix4) if it is not defective.

  • Replace defective pixel (pix1) with the next pixel (pix2) if the previous pixel (pix0) is defective or non-existent.

  • Replace defective pixel (row n, pix1) with the left diagonal pixel on the previous line (row n-1, pix0) if both adjacent pixels are defective.

  • Replace defective pixel (row n, pix5) with the right diagonal pixel on the previous line (row n-1, pix6) if the left diagonal pixel is also defective.

  • Replace defective pixel (row n, pix1) with the corresponding pixel on the previous line (row n-1, pix1) if both left and right diagonal pixels on the previous line are defective.

  • Do nothing when all the neighboring pixels are defective.

Color Defective Pixel Replacement Algorithm

The replacement algorithm rules for a Bayer color sensor are similar to the monochrome rules with the exception that replacement pixels of the same color are used. Only pixels on the same line are considered.

  • Replace defective pixel with the previous pixel of the same color, if it is not defective.

  • Replace defective pixel with the next pixel of the same color if the previous pixel is defective or non-existent.

  • Do nothing when both adjacent pixels of the same color are also defective.