Fixed iOS framework compilation warnings
This commit is contained in:
@@ -185,7 +185,6 @@ class CvVideoWriter_AVFoundation : public CvVideoWriter{
|
||||
AVAssetWriterInput* mMovieWriterInput;
|
||||
AVAssetWriterInputPixelBufferAdaptor* mMovieWriterAdaptor;
|
||||
|
||||
unsigned char* imagedata;
|
||||
NSString* path;
|
||||
NSString* codec;
|
||||
NSString* fileType;
|
||||
@@ -494,15 +493,15 @@ double CvCaptureCAM::getProperty(int property_id){
|
||||
CMFormatDescriptionRef format = [[ports objectAtIndex:0] formatDescription];
|
||||
CGSize s1 = CMVideoFormatDescriptionGetPresentationDimensions(format, YES, YES);
|
||||
|
||||
int width=(int)s1.width, height=(int)s1.height;
|
||||
int w=(int)s1.width, h=(int)s1.height;
|
||||
|
||||
[localpool drain];
|
||||
|
||||
switch (property_id) {
|
||||
case CV_CAP_PROP_FRAME_WIDTH:
|
||||
return width;
|
||||
return w;
|
||||
case CV_CAP_PROP_FRAME_HEIGHT:
|
||||
return height;
|
||||
return h;
|
||||
|
||||
case CV_CAP_PROP_IOS_DEVICE_FOCUS:
|
||||
return mCaptureDevice.focusMode;
|
||||
@@ -660,7 +659,8 @@ bool CvCaptureCAM::setProperty(int property_id, double value) {
|
||||
- (void)captureOutput:(AVCaptureOutput *)captureOutput
|
||||
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||
fromConnection:(AVCaptureConnection *)connection{
|
||||
|
||||
(void)captureOutput;
|
||||
(void)connection;
|
||||
// Failed
|
||||
// connection.videoOrientation = AVCaptureVideoOrientationPortrait;
|
||||
|
||||
@@ -714,26 +714,26 @@ fromConnection:(AVCaptureConnection *)connection{
|
||||
memcpy(imagedata, baseaddress, currSize);
|
||||
|
||||
if (image == NULL) {
|
||||
image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 4);
|
||||
image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 4);
|
||||
}
|
||||
image->width =width;
|
||||
image->height = height;
|
||||
image->width = (int)width;
|
||||
image->height = (int)height;
|
||||
image->nChannels = 4;
|
||||
image->depth = IPL_DEPTH_8U;
|
||||
image->widthStep = (int)rowBytes;
|
||||
image->imageData = imagedata;
|
||||
image->imageSize = currSize;
|
||||
image->imageSize = (int)currSize;
|
||||
|
||||
if (bgr_image == NULL) {
|
||||
bgr_image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 3);
|
||||
bgr_image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 3);
|
||||
}
|
||||
bgr_image->width =width;
|
||||
bgr_image->height = height;
|
||||
bgr_image->width = (int)width;
|
||||
bgr_image->height = (int)height;
|
||||
bgr_image->nChannels = 3;
|
||||
bgr_image->depth = IPL_DEPTH_8U;
|
||||
bgr_image->widthStep = (int)rowBytes;
|
||||
bgr_image->imageData = bgr_imagedata;
|
||||
bgr_image->imageSize = currSize;
|
||||
bgr_image->imageSize = (int)currSize;
|
||||
|
||||
cvCvtColor(image, bgr_image, CV_BGRA2BGR);
|
||||
|
||||
@@ -742,7 +742,7 @@ fromConnection:(AVCaptureConnection *)connection{
|
||||
// iOS provides hardware accelerated rotation through AVCaptureConnection class
|
||||
// I can't get it work.
|
||||
if (bgr_image_r90 == NULL){
|
||||
bgr_image_r90 = cvCreateImage(cvSize(height, width), IPL_DEPTH_8U, 3);
|
||||
bgr_image_r90 = cvCreateImage(cvSize((int)height, (int)width), IPL_DEPTH_8U, 3);
|
||||
}
|
||||
cvTranspose(bgr_image, bgr_image_r90);
|
||||
cvFlip(bgr_image_r90, NULL, 1);
|
||||
@@ -942,29 +942,29 @@ IplImage* CvCaptureFile::retrieveFramePixelBuffer() {
|
||||
memcpy(imagedata, baseaddress, currSize);
|
||||
|
||||
if (image == NULL) {
|
||||
image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 4);
|
||||
image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 4);
|
||||
}
|
||||
|
||||
image->width =width;
|
||||
image->height = height;
|
||||
image->width = (int)width;
|
||||
image->height = (int)height;
|
||||
image->nChannels = 4;
|
||||
image->depth = IPL_DEPTH_8U;
|
||||
image->widthStep = rowBytes;
|
||||
image->widthStep = (int)rowBytes;
|
||||
image->imageData = imagedata;
|
||||
image->imageSize = currSize;
|
||||
image->imageSize = (int)currSize;
|
||||
|
||||
|
||||
if (bgr_image == NULL) {
|
||||
bgr_image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 3);
|
||||
bgr_image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 3);
|
||||
}
|
||||
|
||||
bgr_image->width =width;
|
||||
bgr_image->height = height;
|
||||
bgr_image->width = (int)width;
|
||||
bgr_image->height = (int)height;
|
||||
bgr_image->nChannels = 3;
|
||||
bgr_image->depth = IPL_DEPTH_8U;
|
||||
bgr_image->widthStep = rowBytes;
|
||||
bgr_image->widthStep = (int)rowBytes;
|
||||
bgr_image->imageData = bgr_imagedata;
|
||||
bgr_image->imageSize = currSize;
|
||||
bgr_image->imageSize = (int)currSize;
|
||||
|
||||
cvCvtColor(image, bgr_image,CV_BGRA2BGR);
|
||||
|
||||
@@ -1014,7 +1014,7 @@ double CvCaptureFile::getFPS() {
|
||||
}
|
||||
|
||||
double CvCaptureFile::getProperty(int property_id){
|
||||
|
||||
(void)property_id;
|
||||
/*
|
||||
if (mCaptureSession == nil) return 0;
|
||||
|
||||
@@ -1055,7 +1055,8 @@ double CvCaptureFile::getProperty(int property_id){
|
||||
}
|
||||
|
||||
bool CvCaptureFile::setProperty(int property_id, double value) {
|
||||
|
||||
(void)property_id;
|
||||
(void)value;
|
||||
/*
|
||||
if (mCaptureSession == nil) return false;
|
||||
|
||||
@@ -1265,7 +1266,7 @@ bool CvVideoWriter_AVFoundation::writeFrame(const IplImage* iplimage) {
|
||||
// writer status check
|
||||
if (![mMovieWriterInput isReadyForMoreMediaData] || mMovieWriter.status != AVAssetWriterStatusWriting ) {
|
||||
NSLog(@"[mMovieWriterInput isReadyForMoreMediaData] Not ready for media data or ...");
|
||||
NSLog(@"mMovieWriter.status: %d. Error: %@", mMovieWriter.status, [mMovieWriter.error localizedDescription]);
|
||||
NSLog(@"mMovieWriter.status: %d. Error: %@", (int)mMovieWriter.status, [mMovieWriter.error localizedDescription]);
|
||||
[localpool drain];
|
||||
return false;
|
||||
}
|
||||
|
@@ -150,6 +150,7 @@
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +235,7 @@
|
||||
|
||||
- (void)deviceOrientationDidChange:(NSNotification*)notification
|
||||
{
|
||||
(void)notification;
|
||||
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
||||
|
||||
switch (orientation)
|
||||
@@ -250,7 +252,7 @@
|
||||
default:
|
||||
break;
|
||||
}
|
||||
NSLog(@"deviceOrientationDidChange: %d", orientation);
|
||||
NSLog(@"deviceOrientationDidChange: %d", (int)orientation);
|
||||
|
||||
[self updateOrientation];
|
||||
}
|
||||
@@ -324,7 +326,7 @@
|
||||
|
||||
// support for autofocus
|
||||
if ([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
|
||||
NSError *error = nil;
|
||||
error = nil;
|
||||
if ([device lockForConfiguration:&error]) {
|
||||
device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
|
||||
[device unlockForConfiguration];
|
||||
|
@@ -101,7 +101,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
|
||||
[super start];
|
||||
|
||||
if (self.recordVideo == YES) {
|
||||
NSError* error;
|
||||
NSError* error = nil;
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[self videoFileString]]) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:[self videoFileString] error:&error];
|
||||
}
|
||||
@@ -424,6 +424,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
|
||||
|
||||
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
|
||||
{
|
||||
(void)captureOutput;
|
||||
(void)connection;
|
||||
if (self.delegate) {
|
||||
|
||||
// convert from Core Media to Core Video
|
||||
@@ -462,9 +464,8 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
|
||||
}
|
||||
|
||||
// delegate image processing to the delegate
|
||||
cv::Mat image(height, width, format_opencv, bufferAddress, bytesPerRow);
|
||||
cv::Mat image((int)height, (int)width, format_opencv, bufferAddress, bytesPerRow);
|
||||
|
||||
cv::Mat* result = NULL;
|
||||
CGImage* dstImage;
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(processImage:)]) {
|
||||
@@ -473,7 +474,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
|
||||
|
||||
// check if matrix data pointer or dimensions were changed by the delegate
|
||||
bool iOSimage = false;
|
||||
if (height == image.rows && width == image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
|
||||
if (height == (size_t)image.rows && width == (size_t)image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
|
||||
iOSimage = true;
|
||||
}
|
||||
|
||||
@@ -591,7 +592,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
|
||||
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
|
||||
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
|
||||
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
|
||||
completionBlock:^(NSURL *assetURL, NSError *error){}];
|
||||
completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -58,10 +58,10 @@
|
||||
namespace cv
|
||||
{
|
||||
static const char fmtSignTiffII[] = "II\x2a\x00";
|
||||
static const char fmtSignTiffMM[] = "MM\x00\x2a";
|
||||
|
||||
#ifdef HAVE_TIFF
|
||||
|
||||
static const char fmtSignTiffMM[] = "MM\x00\x2a";
|
||||
static int grfmt_tiff_err_handler_init = 0;
|
||||
static void GrFmtSilentTIFFErrorHandler( const char*, const char*, va_list ) {}
|
||||
|
||||
|
@@ -43,6 +43,9 @@
|
||||
#import "opencv2/highgui/cap_ios.h"
|
||||
#include "precomp.hpp"
|
||||
|
||||
UIImage* MatToUIImage(const cv::Mat& image);
|
||||
void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist);
|
||||
|
||||
UIImage* MatToUIImage(const cv::Mat& image) {
|
||||
|
||||
NSData *data = [NSData dataWithBytes:image.data
|
||||
|
Reference in New Issue
Block a user