2018-12-02 17:10:48 -0600
| received badge | ● Popular Question
(source)
|
2018-01-10 04:51:42 -0600
| received badge | ● Notable Question
(source)
|
2017-01-04 06:09:00 -0600
| received badge | ● Popular Question
(source)
|
2014-06-22 06:58:43 -0600
| received badge | ● Student
(source)
|
2014-06-09 01:24:08 -0600
| asked a question | Accesing Multiple Video device (webcam + IEEE1394) camera HI,
All i got Ubuntu 12.04 OS, where i need to open two video device one being Unibrain IEEE1394 and another normal webcam when i connect my webcam in dev shows
Video0
After connecting my Unibrain IEEE13494 i get v4l
ls /dev/v4l/
by-id by-path where
ls by-id
usb-045e_USB_camera-video-index0
ls by-path
pci-0000:00:1d.2-usb-0:2:1.0-video-index0
So this been a problem to access my both cameras from opencv capture index when i say
Capture=cvCaptureFromCAM(0); i get Only IEE1394 not the webcam, is there any method to set the index of the device. Of course i am aware that Windows has got its own flavour of accessing through name. Any pointers will be appreciated. |
2014-04-02 11:07:59 -0600
| received badge | ● Self-Learner
(source)
|
2014-04-02 09:37:14 -0600
| commented answer | cvDecodeImage - after streaming fails Kindly excuse me. I find its 0101....take time.. some part are not getting formatted. I cut and pasted from gedit and gvim. |
2014-04-02 09:35:01 -0600
| answered a question | cvDecodeImage - after streaming fails Thanks berak. I finally did encoding and decoding using mat my code below the data is streamed using tcp
Let me know if anyquestions.
Encoding #define JPEG_HEADER_0 0xff
#define JPEG_HEADER_1 0xd8
#define JPEG_END_2 0xff
#define JPEG_END_1 0xd9
Mat drawing;
unsigned char VideoBuffer[1024*10] ; //ofcourse keep u r req size
vector<int> param = vector<int>(2); param[0]=CV_IMWRITE_JPEG_QUALITY; param[1]=60;//default(95) 0-100 vector<uchar> encodeBuff;//buffer for coding
imencode(".jpg",drawing,encodeBuff,param);
pthread_mutex_lock(&buffer_sync);
if(PacketSize > VIDEO_BUFFER_SIZE)
printf("ERROR Packet Size --------> %d",PacketSize );
PacketSize=encodeBuff.size();
memcpy(&VideoBuffer[0],(char*)&encodeBuff[0],PacketSize);
Decoding imageptr=&SendBuffer[4]; // ok i receive in sendbuffer of unsigned char if( SendBuffer[4]== JPEG_HEADER_0 &&
SendBuffer[5] == JPEG_HEADER_1 &&
SendBuffer[length+3]== JPEG_END_1 &&
SendBuffer[length+2] ==JPEG_END_2 )
{
std::vector<uchar> decodebuff(imageptr,imageptr+(size-4));
Mat decode =imdecode(Mat(decodebuff),CV_LOAD_IMAGE_COLOR);
}
|
2014-03-20 02:04:55 -0600
| asked a question | cvDecodeImage - after streaming fails Camera capture --> Encode -> stream (unsigned char ) -> Recieve -> Decode Encoding side unsigned char Buffer[1024*20];
IplImage *image image=cvQueryFrame(Capture);
encode=cvEncodeImage(".jpg",image,encodeparams);
decode=cvCreateMat(encode->rows,encode->cols,CV_8UC1);
decode->data.ptr=encode->data.ptr; cvShowImage("Server",image);
cvWaitKey(1);
Frame->iSync=0x1;
Frame->iLength=(16+(encode->rows*encode->cols));
Frame->iSize=(encode->rows*encode->cols);
Frame->iWidth=(encode->rows);
Frame->iHeight=(encode->cols);
Frame->iSync=0x1;
Frame->iLength=(16+(encode->rows*encode->cols));
Frame->iSize=(encode->rows*encode->cols);
Frame->iWidth=(encode->rows);
Frame->iHeight=(encode->cols);
memcpy(&bImageData[0],&Frame->iSync,sizeof(int));
memcpy(&bImageData[4],&Frame->iLength,sizeof(int));
memcpy(&bImageData[8],&Frame->iSize,sizeof(int));
memcpy(&bImageData[12],&Frame->iWidth,sizeof(int));
memcpy(&bImageData[16],&Frame->iHeight,sizeof(int));
memcpy(&bImageData[20],encode->data.ptr,sizeof(unsigned char)*encode->rows*encode->cols);
// printf("%d",length );
length = Frame->iLength; while( count < length)
{
offset=send(connect,&bImageData[count],(length-count),0);
if(offset > 1)
{
count +=offset;
// printf("\n Count & %d %d \n",offset,count);
}
if(offset == (-1))
{
printf("closed connection");
goto _error_video_client;
}
}
recv(connect,RecvBuff,sizeof(RecvBuff),0);
}
decoding side define MAKEDWORD(B0,B1,B2,B3) (((unsigned long)B0)+ (((unsigned long)B1)<<8)+
(((unsigned long)B2)<<16)+
(((unsigned long)B3)<<24)) if(offset)
{
if(size > PACKET_HEADER_SIZE )
{ // using QT so this... to get the header info.
iSync = MAKEDWORD(CopyData.at(0),CopyData.at(1),CopyData.at(2),CopyData.at(3));
iLength = MAKEDWORD(CopyData.at(4),CopyData.at(5),CopyData.at(6),CopyData.at(7));
iSize = MAKEDWORD(CopyData.at(8),CopyData.at(9),CopyData.at(10),CopyData.at(11));
iRows = MAKEDWORD(CopyData.at(12),CopyData.at(13),CopyData.at(14),CopyData.at(15));
iCols = MAKEDWORD(CopyData.at(16),CopyData.at(17),CopyData.at(18),CopyData.at(19));
std::cout << "iLength " << iLength;
std::cout << "isize " << iSize << "iWidth " << iRows << " iHeight" << iCols;
offset=0;
if((iLength < 0) && iLength > FRAME_LENGTH )
offset=1;
count=size;
memcpy(&FrameBuffer[0],&CopyData,size);
std::cout << "Size" << size;
}
}
else
{
memcpy(&FrameBuffer[count],&CopyData,size); // keep until u reach the count == length
count+=size;
if(count == iLength)
{
decode =cvCreateMat(iRows,iSize,CV_8UC1);
decode->data.ptr=&FrameBuffer[20];
frame = cvDecodeImage(decode,CV_LOAD_IMAGE_COLOR);
if(frame)
std::cout << "Valid Frame";
else
std::cout << "Not a Valid Frame "; // I am not aware why this is going invalid frame after sending all the trasnmission are using unsigned char buffer.
}
}
|
2014-01-22 08:26:39 -0600
| asked a question | finding image coordinate from contour I have a problem with finding contour point. findContours(canny_output,contours,heirachy,CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,Point(0,0));
for(unsigned int i=0;i<contours.size(),i++)
{
for(unsigned int j=0;j<contours[i].size(),j++)
{
cout << "Point(x,y)=" << contours[i][j] << endl;
}
}
How to get this to x & y of image matrix when i try to cout its 11122333 huge number number... ? Printing cvpoint is also huge number, I need (x,y) coordinates. |
2014-01-10 00:25:58 -0600
| asked a question | throwing exception in matching function "OpenCV Error: Assertion failed ((globalDescIdx>=0) && (globalDescIdx < size())) in getLocalIdx, file opencv-2.4.7/modules/features2d/src/matchers.cpp, line 163
terminate called after throwing an instance of 'cv::Exception'" I read that it happens because of the frame being empty so i make the code as below if(!**image.empty**()) // image from camera
{
detector.detect( image, kp_image );
extractor.compute( image, kp_image, des_image );
**if(!des_image.empty())**
matcher.knnMatch(des_object, des_image, matches, 2);
for(int i = 0; i < min(des_image.rows-1,(int) matches.size()); i++) //THIS LOOP IS SENSITIVE TO SEGFAULTS
{
if((matches[i][0].distance < 0.6*(matches[i][1].distance)) && ((int) matches[i].size()<=2 && (int) matches[i].size()>0))
{
good_matches.push_back(matches[i][0]);
}
}
if((matches[i][0].distance < 0.6*(matches[i][1].distance)) && ((int) matches[i].size()<=2 && (int) matches[i].size()>0))
{
good_matches.push_back(matches[i][0]);
}
}
//Draw only "good" matches
// drawMatches( object, kp_object, image, kp_image, good_matches, img_matches, Scalar::all(-1), Scalar::all(-1), vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
if (good_matches.size() >= 4)
{
for( int i = 0; i < good_matches.size(); i++ )
{
//Get the keypoints from the good matches
obj.push_back( kp_object[ good_matches[i].queryIdx ].pt );
scene.push_back( kp_image[ good_matches[i].trainIdx ].pt );
}
H = findHomography( obj, scene, CV_RANSAC );
perspectiveTransform( obj_corners, scene_corners, H);
cout << "X and Y " << scene_corners[2].x << " " <<scene_corners[2].y<< "\n";
//Draw lines between the corners (the mapped object in the scene image )
line( image, scene_corners[0] , scene_corners[1] , Scalar(0, 255, 0), 4 );
line( image, scene_corners[1] , scene_corners[2] , Scalar( 0, 255, 0), 4 ); // vertical left top to bottom
line(image, scene_corners[2] , scene_corners[3] , Scalar( 0, 255, 0), 4 );
line( image, scene_corners[3] , scene_corners[0] , Scalar( 0, 255, 0), 4 );
}
imshow( "good matches", image );
key = waitKey(1);
}
Still it throws the exception
|
2013-11-26 22:59:03 -0600
| answered a question | adding opencv to my existing makefile Problem with the script in the same make file, so with the above flag opencv get linked in the project. thanks |
2013-11-26 07:51:28 -0600
| commented answer | handling camera buffer thanks..it solved problem |
2013-11-26 01:16:19 -0600
| asked a question | handling camera buffer In my project i already have camera output in a buffer ProcessFrames(unsigned char *RefFrame,unsigned char *CurrentFrame, int width,int height)
{
IplImage *ReferenceImage = cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
IplImage *CurrentImage = cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
IplImage *ResultImage = cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,1);
// my camera input is Grey so i keep all at same depth
cvSetData( ReferenceImage, RefFrame, width );
cvSetData( CurrentImage, CurrentFrame, width ); // fine until here
cvAbsDiff(ReferenceImage, CurrentImage, ResultImage);
// here is the culprit for crash
// can somebody point what is going wrong here
//finally i do this
cvReleaseImageHeader(&ReferenceImage);
cvReleaseImageHeader(&CurrentImage);
cvReleaseImageHeader(&ResultImage);
}
after core dump i get the message OpenCV Error: Bad argument (Unknown array type) in cvarrToMat
Downloads/opencv-2.4.7/modules/core/src/matrix.cpp, line 698
terminate called after throwing an instance of 'cv::Exception'
what(): Downloads/opencv-2.4.7/modules/core/src/matrix.cpp:698: error: (-5) Unknown array type in function cvarrToMat
|
2013-11-25 01:17:36 -0600
| commented question | adding opencv to my existing makefile It worked there was a problem because of the script. thanks |
2013-11-24 11:25:26 -0600
| received badge | ● Editor
(source)
|
2013-11-24 11:23:47 -0600
| asked a question | adding opencv to my existing makefile I need to add the opencv for image detection into my existing camera project, I get link error that
undefined reference to `cvCreateImage'. Can you pointout what need to be done in my Makefile
i just added to my exsisting Makefile ( I cant use cMake) CFLAGS = 'pkg-config --cflags opencv' -g -O2 CPP = gcc -E DEPS_CFLAGS = -pthread -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/SDL -I/usr/local/include/opencv -I/usr/local/include/ DEPS_LIBS = 'pkg-config --libs opencv' -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lSDL -lportaudio -lasound -lm -lpthread -lpng12 -lavcodec -lavutil -lv4l2 -ludev -lrt Can you guys point out what i wrong here in the Makefile.
|