Ask Your Question

bubbely's profile - activity

2017-08-20 11:28:17 -0600 asked a question Question about resizing and cropping

https://snag.gy/DOdZBc.jpg

First: I have an image that I want to adjust the resolution of to a set resolution with a desired scale to ratio around the head..

currently i have this going

widthO, heightO = image.shape[:2] ## original width and height
image = cv2.resize(image,(2170, 2894), interpolation = cv2.INTER_AREA)
new_dimensionX = heightO * 631 / ((pointOfEight)  - (pointOfInterestX))
new_dimensionY = widthO * 631 / ((pointOfEight) - (pointOfInterestX ))
image = cv2.resize(image,(int(new_dimensionX), int(new_dimensionY))

I need the head to be with the height of 631. I'd like to maintain the 2170,2894 size on the last calculation. Any help?

Also, on that note. Once that occurs, I can calculate those three dots. And I want to center the image based on the middle dot such that the nose will have a straight line going vertically through it at the center.

This is my attempt:

Rx = new_dimensionX / heightO
Ry = new_dimensionY / widthO
crop_img = crop_img[0:2894,  int((pointOfNose  - 2170/2) * Ry):int(pointOfNose  + 2170/2 * Ry)]
2017-08-16 03:48:44 -0600 asked a question Snap to grid cropping

This may be called "Region of Interest" I'm not exactly sure. But, what I'd like to do is rather easy to explain.

I have a photo that I need to align to a grid.

https://snag.gy/YaAWdg.jpg

For starters; the little text that says "here" must be 151px from the top of the screen.

Next; from "here" to position 8 of the chin must be 631px

Finally; a straight line down the middle of the picture at line 28 on the nose must be done.

If i'm not making sense please tell me to elaborate.

I have the following ideas (this is pseudo code)

It is simply to loop until the requirements are met with a resize function, a lot like brute forcing but thats all i can think of..

i.e..

while (top.x,y = 151,0)
img.top-=1  ## this puts the image one pixel above until reaching the desired positioning
while (top.x,y & eight.x,y != 631)
resize += 1 # resize by 1 pixel until the height is reached
## center the nose
image.position = nose.
2017-08-16 02:36:46 -0600 asked a question Please help me with HEAD cascades

I need to find the entire head, not just the face. I found one cascade for head + shoulders, doesn't work too well..

2017-08-16 01:41:11 -0600 asked a question OpenCV and CR2 Files.

Woah I need help with this one. I can't get PythonMagick working because it is no longer supported. I can't use DCRaw because its too confusing. I can't use raw kit because it doesn't work well. What can I do to open a CR2 file with OpenCV?!

2017-08-12 12:15:31 -0600 asked a question Free Transform / Image Resize

Image resize does not maintain the photo quality when used. Photoshop has a Free Transform feature, I want something similar. Does it exist in OpenCV?

2017-08-12 10:56:30 -0600 asked a question detect chin

Hi. https://pasteboard.co/GFkkrtj.png

I've come far enough to be able to detect the top of a head with its hair and the chin in this method.

I'm writing a program to process images in a specific format so the head will always be easy to detect. The chin is usually 8. I need an accurate way of calculating what # the chin is! Any ideas?

2017-08-12 10:55:11 -0600 asked a question detect chin

Hi. https://pasteboard.co/GFkkrtj.png

I've come far enough to be able to detect the top of a head with its hair and the chin in this method.

I'm writing a program to process images in a specific format so the head will always be easy to detect.

The chin is usually 8. I need an accurate way of calculating what # the chin is! Any ideas?

2017-08-10 07:22:59 -0600 asked a question MacOS Facial Recognition

I would like to detect the entire head, hair included, not just the face. I can't seem to get any iOS examples working. I'm coding on macOS. If someone can show me some working examples for head detection on macOS please do so.

2017-02-12 11:56:49 -0600 asked a question Cannot run...
package com.example.qwill.opencvtests;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;


import org.opencv.android.BaseLoaderCallback;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Core;
import org.opencv.core.KeyPoint;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDMatch;
import org.opencv.core.MatOfKeyPoint;
import org.opencv.features2d.DescriptorMatcher;
import org.opencv.features2d.Feature2D;
import org.opencv.features2d.FeatureDetector;
import org.opencv.features2d.Features2d;
import org.opencv.photo.Photo;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.utils.Converters;
import org.opencv.android.Utils;



import java.io.File;
import java.util.Vector;


public class MainActivity extends AppCompatActivity {

    FeatureDetector test;
    private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
        @Override
        public void onManagerConnected(int status) {
            switch (status) {
                case LoaderCallbackInterface.SUCCESS: //opencv is loaded!
                {

                    test = FeatureDetector.create(FeatureDetector.FAST); //feature detector goes here!

                    MatOfKeyPoint one = new MatOfKeyPoint();
                    MatOfKeyPoint two = new MatOfKeyPoint();

                    Mat image1, image2;
                    image1 = Imgcodecs.imread(ResourcesCompat.getDrawable(getResources(), R.drawable.one, null).toString());

                    image2 = Imgcodecs.imread(ResourcesCompat.getDrawable(getResources(), R.drawable.two, null).toString());

                    Mat imageOut = image1.clone();

                    test.detect(image1, one);
                    test.detect(image2, two);

                    DescriptorMatcher descriptorMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
                    MatOfDMatch matches = new MatOfDMatch();

                    descriptorMatcher.match(image1, image2, matches);
                    Features2d.drawMatches(image1, one, image2, two, matches, imageOut);

                    Bitmap bm = Bitmap.createBitmap(imageOut.cols(), imageOut.rows(), Bitmap.Config.ARGB_8888);
                    Utils.matToBitmap(imageOut, bm);
                    Log.d("TEST", " worked ");
                } break;
                default:
                {
                    super.onManagerConnected(status);
                } break;
            }
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



    }

    @Override
    protected void onStart() {
        super.onStart();
        if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback))
        {
            Log.d("TEST", "Cannot connect to OpenCV Manager");
        }
    }
}

My first attempts to put all my code in onCreate just lead to a crash that said my program continues to close, so I googled that situation and found the callback resolve but I can't get the callback to work? i just get my error Cannot connect to OpenCV Manager. Help please.

EDIT::::

Fixed the first issue..

Second issue::::

DescriptorMatcher descriptorMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);

displays this error

java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.features2d.DescriptorMatcher.create_1(int) (tried Java_org_opencv_features2d_DescriptorMatcher_create_11 and Java_org_opencv_features2d_DescriptorMatcher_create_11__I)