Created
March 12, 2013 15:43
-
-
Save s-mage/5143984 to your computer and use it in GitHub Desktop.
Pornodance with openCV and mathcad possibility tu create user DLL. I don't know, how to compile it in windows.
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
#include "MCADINCL.H" | |
#include <opencv2/highgui/highgui.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
// Reading frame and convert it into MathCad matrix(complexarray). | |
// | |
LRESULT video2MathCad(COMPLEXARRAY * const result, const char * path_to_video, | |
const int frame_number) | |
{ | |
CvCapture* capture = cvCreateFileCapture(path_to_video); | |
cvSetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES, frame_number); | |
IplImage* frame = cvQueryFrame(capture); | |
char* data = frame->imageData; | |
// Allocate memory for MathCad matrix. Built-in MathCad method. | |
// | |
MathcadArrayAllocate(result, frame->width, frame->height, true, false); | |
for(int i = 0; i < frame->width; i++) | |
for(int j = 0; j < frame->height; j++) { | |
result->hReal[i][j] = data[i * frame->height + j]; | |
} | |
return 0; | |
} | |
FUNCTIONINFO frame = { frame, "path_to_video, frame_number", | |
(LPCFUNCTION)video2MathCad; COMPLEX_ARRAY, 2, | |
{ char*, int } }; | |
bool WINAPI DllEntryPoint (HISTANCE hDLL, DWORD dwReason, LPVOID lpreserved) | |
{ | |
CreateUserFunction(hDLL, &frame); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment