sigsegv with gsvideo
in
Contributed Library Questions
•
3 years ago
Hey,
I'm getting sigsegv with a simple gsvideo based program. Processing is 1.0.9, gsvideo is 0.6 pre5, linux is ubuntu 8.10.
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb7dea896, pid=7246, tid=2691038096
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode linux-x86 )
# Problematic frame:
# C [libc.so.6+0x79896] memcpy+0x46
#
# An error report file with more information is saved as:
# /home/matthew/processing-1.0.9/hs_err_pid7246.log
#
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
- import codeanticode.gsvideo.*;
- color black = color(0);
- color white = color(255);
- float boundaries, thresh;
- static int controlsWidth = 200;
- int numPixels;
- GSCapture video;
- static int maxBoundaries = 4;
- static int vidWidth, vidHeight;
- void setup()
- {
- vidWidth = 320;
- vidHeight = 240;
- size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480
- fs = new FullScreen(this);
- strokeWeight(5);
- // Uses the default video input, see the reference if this causes an error
- video = new GSCapture(this, vidWidth, vidHeight, 8);
- numPixels = video.width * video.height;
- }
- void draw()
- {
- int threshold = (int)map( mouseX, 0, width, 0, 255 );
- if (video.available() && mousePressed)
- {
- video.read();
- video.loadPixels();
- // int threshold = (int)thresh; //map( (float)mouseX, 0, width, 0, 255 ); // Set the threshold value
- float pixelBrightness; // Declare variable to store a pixel's color
- // Turn each pixel in the video frame black or white depending on its brightness
- loadPixels();
- for (int i = 0; i < numPixels; i++)
- {
- pixelBrightness = brightness(video.pixels[i]);
- if (pixelBrightness > threshold)
- { // If the pixel is brighter than the
- video.pixels[i] = white; // threshold value, make it white
- }
- else
- { // Otherwise,
- video.pixels[i] = black; // make it black
- }
- }
- copy(video, 0, 0 , vidWidth, vidHeight ,0, 0, width , height );
- updatePixels( );
- }
- }