I have written the following piece of code to extract the image of the region detected as face using the OpenCV2.2 facedetect.c code.
//Extracting the image of just the ROI
IplImage* rectImage;
rectImage->roi=NULL;
CvRect boundingBox={point1.x,point1.y,r->width,r->height};
cvSetImageROI(rectImage,boundingBox);
IplImage* originalBox=cvCreateImage(cvSize(r->width,r->height),IPL_DEPTH_8U,3);
IplImage* reSizedBox=cvCreateImage(cvSize(100,100),IPL_DEPTH_8U,3);
cvCopy(rectImage, originalBox, 0);
cvResize(originalBox,reSizedBox,CV_INTER_LINEAR);
cvSaveImage("MyFaceBox.jpg", reSizedBox);
Problem: When I build it, it gives the following error:
"error: ‘cvResize’ was not declared in this scope"
I am using xcode as a developer tool. I cannot understand what is creating the problem. Can someone please help?
Thanks
Did you include the relating header file, like
#include <imgproc/imgproc_c.h>
Related
I'm trying to get a texture id from metal surface.
I have two problems
1. That function is not defined
GLint glTextureID = CGLTexImageIOSurface2D(self.mEAGLContext, GL_TEXTURE_2D, GL_RGBA , textureWidth, textureHeight, GL_RGBA , GL_UNSIGNED_BYTE, ioSurface, 0);
I tried to include it #import OpenGL/CGLIOSurface.h
but xcode doesn't recognize it, it's not there.
Are there any other methods to obtain a texture id from an iosurface in ios, metal ?
In my software, the following line pulls in the requested function:
#include <OpenGL/CGLIOSurface.h>
This header file is at the following location in my xcode installation:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/CGLIOSurface.h
Note that I am using the MacOS SDK. Perhaps iOS doesn't support GL/IOSurface sharing?
I had installed CUDA 9.1 previously and tested my OpenCV with the code below, all worked fine but later on I had to remove it and install 8.0. Now the below code gives errors since the previous dlls are searched.
Here is my test code:
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/cudaarithm.hpp"
using namespace cv;
int main(int argc, char* argv[])
{
try
{
cv::Mat src_host = cv::imread("hdd.png", cv::IMREAD_GRAYSCALE);
cv::cuda::GpuMat dst, src;
src.upload(src_host);
cv::cuda::threshold(src, dst, 128.0, 255.0, cv::THRESH_BINARY);
cv::Mat result_host(dst);
cv::namedWindow("Result", cv::WINDOW_NORMAL);
cv::imshow("Result", result_host);
cv::waitKey();
}
catch (const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
}
Here is the error:
The code execution cannot proceed because cudart64_91.dll was not found. Reinstalling the program may fix this problem.
It asks for 2-3 more dlls when I click on OK button, but I am not gonna write them here as I suspect the problem arises from the same source.
The problem is rather obvious. The dlls which are tried to be loaded, belong to the uninstalled version of CUDA (9.1), whereas I have now 8.0. I do not know why my Visual Studio 2013 tries to load the previous ones still.
Before anyone asks, yes I do have my newer installation (8.0) in my PATH. I am using Windows 10 x64, if it matters.
The real problem behind your error:
OpenCV was built with CUDA 9.1, this will not change even if you change the CUDA installation, thus it will the DLLs from CUDA 9.1 will always be required for every program that is compiled with OpenCV. Maybe a module does not have this linked and you can use it... but I am almost sure the main ones do and you won't be able to use them.
Possible solutions:
Build OpenCV with CUDA 8.0 then it will require is CUDA 8.0 DLLs and not the 9.1 ones.
Install CUDA 9.1. Both CUDA can be installed in the same computer, that is why they have this _80 or _91, this way you can have both paths and the computer decide which one is needed... I think it is not possible to have BOTH in the same program though, so be careful with this option. If it is only used by OpenCV then it will be ok.
I would recommend the first option, it is safer to stick to one library version...
I'm a beginner to opencv, and I've been trying out some basic things using the library. I've added all the dependencies in VS, so generally the image processing related codes work. However, I am getting the following error on the console for one video-related program:
warning: Error opening file
(/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578) Press any
key to continue.
My code is as follows:
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
using namespace cv;
int main(int argc, char** argv) {
namedWindow("Video", WINDOW_AUTOSIZE);
VideoCapture cap;
cap.open(argv[1]);
Mat frame;
for (;;) {
cap >> frame;
if (frame.empty()) break;
imshow("Video", frame);
if (waitKey(33) >= 0) break;
}
return 0;
}
I downloaded ffmpeg, and added it my Path environment variable as well, it did not work.
I've searched quite extensively online for this, but to no avail. Any help is appreciated.
I am using VerificationController.m provided by Raywenderlich for validating receipts for in ap purchase. It is working fine for XCode5 but in XCode6 it is giving number of errors. probably due to C++ code like:
Missing Code for Method declaration
#end must appear in objective-c
context Conflicting types for 'checkReiptSecurity'
can anyone tell me what is needed to be done ?
Edit : Here are errors screenshot
Have you fixed this? I was running in to the exact same problem so I'll leave my fix here for anyone that comes looking. It turns out in newer versions of Xcode you aren't allowed to put C/C++ code in objective-C context anymore. So I moved the declarations for unsigned int iTS_intermediate_der_len, unsigned char iTS_intermediate_der[], char* base64_encode(const void* buf, size_t size), and void * base64_decode(const char* s, size_t * data_len) to the top of the file, above the #implementation tag.
Have you downloaded sample code? I have downloaded sample code and its working fine at my side. It seems that you have missed or added an extra braket } or { in your code.
May be this happened when you was trying to comment this code [UIDevice currentDevice].uniqueIdentifier; because originally this line produce an error.
I am trying to do simple image processing with OpenCV and the cvBlobsLib in Visual C++ 2008, and I get an error message when I try to create a CBlobResult object
IplImage* original = cvLoadImage("pic6.png",0);
cvThreshold(original, original, 100, 255, CV_THRESH_BINARY);
CBlobResult blobs = CBlobResult(original, NULL, 255);
The message is the following:
Run-Time Check Failure #2 - Stack around the variable blobs was corrupted
Why does this happen? How should I create this object? Thank you very much for your help.
Sorry. Actually it was my fault. I was trying to compile the debug version of my project with the release version of the cvBlobsLib library. As soon as I linked the debug version it worked.