Open awilkie1 opened 7 years ago
If :
cv::Mat
(OpenCV 2+ matrix image format)Then the answer is yes :)
Have a look at example-ofxCvPiCamSimple
It should be possible to simply grab the frame from the ofxCvPiCam
instance and pass it to ArUco:
//in update
cv::Mat frame = cam.grab();
if(!frame.empty()){
//pass the frame to ArUco here
}
Hi,
by the same logic,
would it be possible to pass an ofxAruco object using ofxCvPiCam. How does one get the pixels from ofxCvPiCam?
Hi @owenplanchart
It would be possible, but bare in my mind my basic addon fetches PiCamera data in cv::Mat
format
while ofxAruco::detectBoards
takes ofPixels & pixels
as an argument. You can use ofxCv to easily wrap cv::Mat
to ofPixels
(for example using toOf(cv::Mat mat, ofPixels_<T>& pixels)
)
Hope this helps, George
Thank you,
I will give this a try
Is this the right implementation?
void ofApp::update(){
cv::Mat frame = cam.grab();
ofPixels arPixels;
toOf(frame, arPixels);
if(!frame.empty()){
aruco.detectBoards(arPixels);
}
}
@owenplanchart That looks good !
You should test it when you get a chance.
The other thing I'd recommend is maybe holding on two the frame
and arPixels
references and maybe doing the the empty()
check before attempting to convert toOf()
, something along these lines:
// in your ofApp.h for example
cv::Mat frame;
ofPixels arPixels;
// in your ofApp.cpp:
void ofApp::update(){
frame = cam.grab();
if(!frame.empty()){
toOf(frame, arPixels);
aruco.detectBoards(arPixels);
}
}
It's really strange because now I'm getting this error when I try to compile:
obj/linuxarmv6l/Release/src/ofApp.o: file not recognized: file truncated
collect2: error: ld returned 1 exit status
make[1]: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:405: bin/cvPiCamChand] Error 1
make[1]: Leaving directory '/home/pi/openFrameworks/apps/myApps/cvPiCamChand'
make: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2
@orgicus Not sure what happened there, so I re-downloaded the addon and wrote the sketch from scratch and managed to get the aruco markers working (yay!). This was on the RP3b (buster) with the Pi cam v2.1. Does this addon work with the pI4? Thanks so much for your work and help on this.
Im trying to use the C::mat for as a source for a video grabber as I want to detect objects such as ArCuo. Can this be done on the pi using the native camera??