Calibrate works?
This commit is contained in:
parent
26e34f7671
commit
cc711c6343
1104 changed files with 636510 additions and 75 deletions
43
lib/opencv_processing/examples/LumaVsGray/LumaVsGray.pde
Normal file
43
lib/opencv_processing/examples/LumaVsGray/LumaVsGray.pde
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Luma is a better measure of perceived brightness than
|
||||
the tradition grayscale created by averaging R, G, and B channels.
|
||||
This sketch demonstrates converting an image to LAB color space
|
||||
and accessign the Luma channel for comparison with the more common
|
||||
grayscale version. Uses un-wrapped OpenCV cvtColor() function.
|
||||
|
||||
*/
|
||||
|
||||
import gab.opencv.*;
|
||||
// Import the OpenCV Improc class,
|
||||
// it has the cvtColor() function we need.
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
OpenCV opencv;
|
||||
PImage colorImage, grayImage;
|
||||
|
||||
void setup() {
|
||||
colorImage = loadImage("flashlight.jpg");
|
||||
opencv = new OpenCV(this, colorImage);
|
||||
size(opencv.width, opencv.height);
|
||||
// Save the gray image so we can compare it to Luma
|
||||
grayImage = opencv.getSnapshot();
|
||||
// Use built-in OpenCV function to conver the color image from BGR to LAB color space.
|
||||
Imgproc.cvtColor(opencv.getColor(), opencv.getColor(), Imgproc.COLOR_BGR2Lab);
|
||||
// Since the channels start out in the order BGRA,
|
||||
// Converting to LAB will put the Luma in the B channel
|
||||
opencv.setGray(opencv.getB());
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
pushMatrix();
|
||||
scale(0.5);
|
||||
image(colorImage, colorImage.width/2, 0);
|
||||
image(grayImage, 0, colorImage.height);
|
||||
image(opencv.getOutput(), colorImage.width, colorImage.height);
|
||||
popMatrix();
|
||||
|
||||
fill(255);
|
||||
text("GRAY", 30, height -25);
|
||||
text("LUMA", width/2 + 30, height - 25);
|
||||
}
|
||||
BIN
lib/opencv_processing/examples/LumaVsGray/flashlight.jpg
Normal file
BIN
lib/opencv_processing/examples/LumaVsGray/flashlight.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
Loading…
Add table
Add a link
Reference in a new issue