Ask Your Question

kaipyroami's profile - activity

2016-04-15 04:28:21 -0600 received badge  Notable Question (source)
2016-02-22 01:34:04 -0600 received badge  Notable Question (source)
2015-06-15 00:53:44 -0600 received badge  Popular Question (source)
2014-11-11 12:35:26 -0600 received badge  Popular Question (source)
2014-08-14 17:11:55 -0600 received badge  Self-Learner (source)
2013-03-27 13:33:40 -0600 commented answer iPad Camera input is rotated 180 degrees.

I am using iOS (iPad) I am at the current version.

2013-03-27 13:32:34 -0600 commented answer iPad Camera input is rotated 180 degrees.

That is a good idea, I am just trying to limit adding any more extra processing if I can help it. I was thinking that the camera input might be easier to correct than flipping the mat.

2013-03-27 13:30:47 -0600 commented answer iPad Camera input is rotated 180 degrees.

If you take the first image you posted and rotate it 180 degrees that is what I am getting. 0,0 should be in the top left but is in fact in the bottom right.

2013-03-11 18:51:20 -0600 received badge  Supporter (source)
2013-03-10 13:03:05 -0600 answered a question iOS6 and defaultAVCaptureVideoOrientation

Fixed while overriding CvVideoCamera. Not entirely sure why it is working now though. :/

2013-03-10 12:58:08 -0600 commented question Closed eye detection C++

Are you only able to detect open eyes? But you can detect the left and right eye only when open?

2013-03-10 12:57:45 -0600 answered a question Closed eye detection C++

Are you only able to detect open eyes? But you can detect the left and right eye only when open?

2013-03-10 12:54:20 -0600 answered a question Haarcascade "KILLED"

Just an observation, though it might solve the problem. You are using an extremely small nimber of sample images. I am using 2,000+ negatives and 3,000+ positives. Perhaps there are not enough images to start one full stage?

2013-03-10 12:48:46 -0600 answered a question OpenCV setting iOS orientation

You need to override - (void)updateOrientation and - (void)layoutPreviewLayer.

CvVideoCameraMod.h

 #import <opencv2/highgui/cap_ios.h>

@protocol CvVideoCameraDelegateMod <CvVideoCameraDelegate>
@end

@interface CvVideoCameraMod : CvVideoCamera

- (void)updateOrientation;
- (void)layoutPreviewLayer;

@property (nonatomic, retain) CALayer *customPreviewLayer;

@end

CvVideoCameraMod.m

#import "CvVideoCameraMod.h"

 #define DEGREES_RADIANS(angle) ((angle) / 180.0 * M_PI)

@implementation CvVideoCameraMod

- (void)updateOrientation;
{
    NSLog(@"Would be rotating now... but I stopped it! :)");
    self.customPreviewLayer.bounds = CGRectMake(0, 0, self.parentView.frame.size.width, self.parentView.frame.size.height);
    [self layoutPreviewLayer];
}



- (void)layoutPreviewLayer;
{
    if (self.parentView != nil)
    {
        CALayer* layer = self.customPreviewLayer;
        CGRect bounds = self.customPreviewLayer.bounds;
        int rotation_angle = 0;

        switch (defaultAVCaptureVideoOrientation) {
            case AVCaptureVideoOrientationLandscapeRight:
                rotation_angle = 180;
                break;
            case AVCaptureVideoOrientationPortraitUpsideDown:
                rotation_angle = 270;
                break;
            case AVCaptureVideoOrientationPortrait:
                rotation_angle = 90;
            case AVCaptureVideoOrientationLandscapeLeft:
                break;
            default:
                break;
        }

        layer.position = CGPointMake(self.parentView.frame.size.width/2., self.parentView.frame.size.height/2.);
        layer.affineTransform = CGAffineTransformMakeRotation( DEGREES_RADIANS(rotation_angle) );
        layer.bounds = bounds;
    }
}
@end
2013-03-10 12:39:09 -0600 answered a question iOS and OpenCV - Object Detection seems to be skipping detectMultiScale Method

This works. By using "pathForResource" of NSBundle.

NSString * const TFCascadeFilename = @"haarcascade_TF";//Strings of haar file names

NSString *TF_cascade_name = [[NSBundle mainBundle] pathForResource:TFCascadeFilename ofType:@"xml"];

 //Load haar file, return error message if fail
 if (!TF_cascade.load( [TF_cascade_name UTF8String] )) {
     NSLog(@"Could not load TF cascade!");
 }
2013-03-09 00:26:35 -0600 asked a question iPad Camera input is rotated 180 degrees.

I am having trouble with the input from my camera being rotated 180 degrees. In other words, the image is upside down when my cvPoints and text are correct. But when the image is right side up the X and Y locations are referenced off of the bottom right corner instead of the top left. And text is upside down.

Aside from "AVCaptureVideoOrientation" which rotates everything together is there any way to rotate the camera input relative to OpenCV?

2013-03-01 22:37:01 -0600 asked a question OpenCV setting iOS orientation

Is there anyway to stop openCV from rearranging camera input to align with the devices current orientation? I have an app that is set to a single orientation only, but as you move it around the openCV image keeps re aligning to match "right side up".

2013-02-28 11:46:13 -0600 received badge  Student (source)
2013-01-27 21:41:08 -0600 asked a question iOS and OpenCV - Object Detection seems to be skipping detectMultiScale Method

Has anyone had any trouble using object detection and iOS? This code works on eclipse with OSX and a webcam. I am able to get the "detection box" drawn on the image so the image is being passed properly to the processImage and detectAndDisplay methods. By adding break points I am able to see that the code appears to execute as expected. I am however not able to get an object that is detected on the webcam to be detected on the iPad.

I am thinking that since the image is passed by reference it might be getting written over before the detection is completed, but I am not sure.

In ViewDidLoad I load the haar files:

  TF_cascade_name = "haarcascade_TF.xml";
    FF_cascade_name = "haarcascade_FF.xml";

    TF_cascade.load( TF_cascade_name );
    FF_cascade.load( FF_cascade_name );

Then here is my image recognition code:

    - (void)processImage:(Mat&)image
{  
    offset_x = 400;
    offset_y = 150;

    cv::Rect myROI(offset_x, offset_y, 500, 200);

    cv::Mat croppedImage = image(myROI);
    [self detectAndDisplay:image detectionROI:croppedImage];     
}

/** detectAndDisplay */
- (void)detectAndDisplay:(Mat&) frame
             detectionROI:(Mat&) ROI_frame
{
    std::vector<cv::Rect> FFs;
    std::vector<cv::Rect> TFs;

    cv::Mat frame_gray;

    cvtColor( ROI_frame, frame_gray, CV_BGR2GRAY );//convert to grayscale
    equalizeHist( frame_gray, frame_gray );

    //-- Make Detection Box
    rectangle(frame, cvPoint(offset_x,offset_y), cvPoint(offset_x + 500,offset_y + 200), cvScalar(0,255,0),2, 1);


    //-- Detect syringe

    TF_cascade.detectMultiScale( frame_gray, TFs, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, cv::Size(30, 30) );

    for( int i = 0; i < TFs.size(); i++ )
    {
        cv::Point center( (TFs[i].x + TFs[i].width*0.5) + offset_x, (TFs[i].y + TFs[i].height*0.5) + offset_y );
        ellipse( frame, center, cv::Size( TFs[i].width*0.5, TFs[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 0 ), 4, 8, 0 );

        Mat faceROI = frame_gray( TFs[i] );
        std::vector<cv::Rect> eyes;        
    }


    FF_cascade.detectMultiScale( frame_gray, FFs, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, cv::Size(30, 30) );

    for( int i = 0; i < FFs.size(); i++ )
    {
        cv::Point center( (FFs[i].x + FFs[i].width*0.5) + offset_x, (FFs[i].y + FFs[i].height*0.5) + offset_y );
        cv::ellipse( frame, center, cv::Size( FFs[i].width*0.5, FFs[i].height*0.5), 0, 0, 360, Scalar( 0, 0, 255 ), 4, 8, 0 );

        Mat faceROI = frame_gray( FFs[i] );
        std::vector<cv::Rect> eyes;
    }
}
2013-01-09 23:08:25 -0600 commented question iOS6 and defaultAVCaptureVideoOrientation

Anyone know if it has to do with "lockForConfiguration"? I am not able to implement it in a CvVideoCamera object, however many other threads show this being a solution to a non-responsive property.

2013-01-01 18:06:17 -0600 received badge  Editor (source)
2013-01-01 18:05:11 -0600 asked a question iOS6 and defaultAVCaptureVideoOrientation

http://docs.opencv.org/trunk/doc/tutorials/ios/video_processing/video_processing.html#opencviosvideoprocessing From the above tutorial are there any known issues with the following line of code and iOS6?

self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;

The orientation seems to be unchanged and is always in portrait even when I use AVCaptureVideoOrientationLandscapeRight.

2012-12-28 11:03:10 -0600 asked a question iOS demo issue.

Using the tutorial posted here.

On this line:

self.videoCamera.delegate = self;

I am getting the error:

Assigning to 'id<cvvideocameradelegate>' from incompatible type 'Camera_FilterViewController *const __strong'

Any pointers on what to check out first?