Translate C++ program to Javascript $30-250 USD $30-250 USD Paid on delivery
I need this translated to Javascript from C++:
#include <opencv2\highgui\highgui_c.h>
#include <opencv2\imgproc\imgproc_c.h>
#include <cstdio>
#include <map>
int main(int argc, char *argv[])
{
if (argc < 2) {
printf("Usage: %s image_file\n", argv[0]);
return 0;
}
const char* inFilename = argv[1];
uint64 id = 0;
IplImage* inImg = cvLoadImage(inFilename);
if (inImg == NULL) {
printf("Error opening %s\n",inFilename);
return -1;
}
IplImage* hsv = cvCreateImage(cvGetSize(inImg), IPL_DEPTH_8U, 3);
cvCvtColor(inImg, hsv, CV_RGB2HSV);
IplImage* v = cvCreateImage(cvGetSize(inImg), IPL_DEPTH_8U, 1);
cvSplit(hsv, NULL, NULL, v, NULL);
CvSize size = cvGetSize(inImg);
[login to view URL] -= [login to view URL] % 8;
[login to view URL] -= [login to view URL] % 8;
IplImage* resv = cvCreateImage(size, IPL_DEPTH_8U, 1);
cvResize(v,resv);
CvSize boxSize = cvSize([login to view URL],[login to view URL]);
IplImage* mask = cvCreateImage(size, IPL_DEPTH_8U, 1);
unsigned char mean[8*8];
for (int ii = 0; ii < 8; ++ii) {
for (int jj = 0; jj < 8; ++jj) {
cvSet(mask,cvScalar(0));
cvDrawRect(mask,cvPoint(jj*[login to view URL],ii*[login to view URL]),cvPoint((jj+1)*[login to view URL], (ii+1)*[login to view URL]),cvScalar(255),-1);
// fprintf(log,"%3u ",(unsigned)cvAvg(resv,mask).val[0]);
mean[ii*8+jj] = (unsigned char)cvAvg(resv,mask).val[0];
}
//fprintf(log,"\n");
}
//FILE* log = fopen("[login to view URL]","w");
unsigned jj = 0;
for (int ii = 0; ii < 8*8 - 1; ++ii) {
int dif = (int) mean[ii] - (int) mean[ii+1];
if (dif >= 0) {
id |= 1LL << jj++;
} else
jj++;
//fprintf(log,"%d\n",dif);
}
printf("%llu\n", id);
//fclose(log);
}
Max 24 hours. Milestone will be set.
Project ID: 5445178
About the project 5 proposals
Remote project
Active 10 yrs ago
Looking to make some money? Email address Apply for similar jobs Benefits of bidding on Freelancer Set your budget and timeframe
It's free to sign up and bid on jobs
5 freelancers are bidding on average $242 USD for this job
Hello,
expert in C++ and JavaScript programing. I can translate your OpenCV code to JavaScript.
Thanks,
Paul
$500 USD in 7 days
5.0 (46 reviews) i can build this using canvas and file api html5 to perform the same action on upload or drop, please contact me if interedted
$250 USD in 0 day
5.0 (16 reviews) Hey Hi, I am pretty good in both the programming languages - C++ and Javascript. Recently, in my office project, I've successfully done the similar task. I can do this for you in the given timelines. Please assign this project to me. Thanks... Saurabh
$230 USD in 3 days
0.0 (0 reviews) From the code you sent I see that it is an opencv program, I have a lot experience programming in opencv in c++ and have done a couple of projects in motion detection with javascript. I will be able to translate this code fairly quickly.
$166 USD in 3 days
0.0 (0 reviews)