opencv - How to store image from cam? -
i started processing.js.
the goal of programme adept image filter(opencv) video frame.
so thought (however found out not working in way :<) :
get video steam capture object in processing.video package. store current image(i hope can store pimage object). adept opencv image filter call image method filtered pimage object.i found out how video stream cam, not know how store this.
import processing.video.*; import gab.opencv.*; capture cap; opencv opencv; public void setup(){ //size(800, 600); size(640, 480); colormode(rgb, 255, 255, 255, 100); cap = new capture(this, width, height); opencv = new opencv(this, cap); cap.start(); background(0); } public void draw(){ if(cap.available()){ //return void cap.read(); } image(cap, 0, 0); }
this code video stream , show gets. however, can not store single frame since capture.read() returns 'void'.
after store current frame transform pimage s opencv :
pimage grayness = opencv.getsnapshot(); opencv.threshold(80); thresh = opencv.getsnapshot(); opencv.loadimage(gray); opencv.blur(12); blur = opencv.getsnapshot(); opencv.loadimage(gray); opencv.adaptivethreshold(591, 1); adaptive = opencv.getsnapshot();
is there decent way store , transform current frame? (i think way - means show frame after save current image , transform - uses lots of resources depend on frame rate)
thanks reply :d
not sure want do, i'm sure solved already, useful anyway...
it seems can write capture object's name straight , returns pimage:
cap = new capture(this, width, height); //code starting , reading capture in here pimage snapshot = cap; //then can whatever wanted pimage snapshot.save("snapshot.jpg"); //actually seems work fine cap.save("snapshot.jpg");
opencv video processing video-capture imagefilter
No comments:
Post a Comment