Image Demosaicking with Contour Stencils
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Functions
displaycontours.c File Reference

Display contours detected by mosaiced contour stencils as EPS. More...

#include <stdio.h>
#include <math.h>
#include "basic.h"
#include "imageio.h"
#include "dmbilinear.h"
#include "mstencils.h"
#include "psio.h"
Include dependency graph for displaycontours.c:

Go to the source code of this file.

Macros

#define ROUNDCLAMP(X)   (((X) < 0) ? 0 : (((X) > 1) ? 255 : floor(X*255 + 0.5f)))
 Round and clamp float X and scale from [0,1] to [0,255]. More...
 

Functions

int DisplayContours (const float *Image, int Width, int Height, int RedX, int RedY, const char *OutputFile)
 Display orientations estimated by mosaiced contour stencils. More...
 

Detailed Description

Display contours detected by mosaiced contour stencils as EPS.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.gmail.nosp@m..com

Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.

This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.

Definition in file displaycontours.c.

Macro Definition Documentation

#define ROUNDCLAMP (   X)    (((X) < 0) ? 0 : (((X) > 1) ? 255 : floor(X*255 + 0.5f)))

Round and clamp float X and scale from [0,1] to [0,255].

Definition at line 24 of file displaycontours.c.

Function Documentation

int DisplayContours ( const float *  Image,
int  Width,
int  Height,
int  RedX,
int  RedY,
const char *  OutputFile 
)

Display orientations estimated by mosaiced contour stencils.

Parameters
Imagethe input RGB image in planar row-major order
Width,Heightthe image dimensions
RedX,RedYthe coordinates of the upper-leftmost red pixel
OutputFileEPS file to write
Returns
1 on success, 0 on failure
Warning
For larger images (e.g., over 300x300), the output EPS file is very large. Some measures are taken for efficient encoding, but compression is not performed.

This routine writes an EPS file of Image superimposed with the orientations detected by mosaiced contour stencils at each pixel. This function is called when running the command line program with the -s option.

For visualization purposes, it is recommended to pass an image that has full color information rather than a mosaiced image (i.e., use the original image or a demosaiced image). The estimated contour orientations are the same regardless of whether the input is mosaiced.

Using the Ghostscript program, the EPS output (say, "contours.eps") can be converted to PDF as

gs -dSAFER -q -P- -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite -sOutputFile=contours.pdf -c .setpdfwrite \
-f contours.eps

Distiller commands are included within the EPS to preserve the bounding box. PDF conversion applies (lossless) deflate compression to the image data, which significantly decreases the file size.

Definition at line 59 of file displaycontours.c.

Here is the call graph for this function:

Here is the caller graph for this function: