-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed pixel copy when image has been decimated
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/test/java/ch/bildspur/realsense/test/DecimationFilterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package ch.bildspur.realsense.test; | ||
|
||
|
||
import ch.bildspur.realsense.RealSenseCamera; | ||
import ch.bildspur.realsense.type.ColorScheme; | ||
import processing.core.PApplet; | ||
import processing.opengl.PJOGL; | ||
|
||
/** | ||
* Created by cansik on 21.03.17. | ||
*/ | ||
public class DecimationFilterTest extends PApplet { | ||
public final static int OUTPUT_WIDTH = 1280; | ||
public final static int OUTPUT_HEIGHT = 500; | ||
|
||
public final static int VIEW_WIDTH = 640; | ||
public final static int VIEW_HEIGHT = 480; | ||
|
||
public final static int FRAME_RATE = 30; | ||
|
||
RealSenseCamera camera = new RealSenseCamera(this); | ||
|
||
public static void main(String... args) { | ||
DecimationFilterTest sketch = new DecimationFilterTest(); | ||
sketch.runSketch(); | ||
} | ||
|
||
public void settings() { | ||
size(OUTPUT_WIDTH, OUTPUT_HEIGHT, FX2D); | ||
PJOGL.profile = 1; | ||
} | ||
|
||
public void setup() { | ||
frameRate(FRAME_RATE); | ||
|
||
if(camera.isDeviceAvailable()) { | ||
println("Camera found!"); | ||
} | ||
else { | ||
println("No camera available!"); | ||
exit(); | ||
} | ||
|
||
camera.enableDepthStream(); | ||
camera.enableColorStream(); | ||
|
||
camera.enableColorizer(ColorScheme.Classic); | ||
camera.addDecimationFilter(7); | ||
|
||
camera.start(); | ||
} | ||
|
||
public void draw() { | ||
// clear screen | ||
background(55); | ||
|
||
camera.readFrames(); | ||
|
||
// show both streams | ||
image(camera.getDepthImage(), 0, 0, VIEW_WIDTH, VIEW_HEIGHT); | ||
image(camera.getColorImage(), VIEW_WIDTH, 0, VIEW_WIDTH, VIEW_HEIGHT); | ||
|
||
fill(255, 255, 255); | ||
textAlign(LEFT, CENTER); | ||
text("Depth Stream", 20, VIEW_HEIGHT + 8); | ||
text("Color Stream", VIEW_WIDTH + 20, VIEW_HEIGHT + 8); | ||
surface.setTitle("RealSense Processing - FPS: " + Math.round(frameRate)); | ||
} | ||
} |