# How to use SIFT in opencv 4.7.0? (Apple, EXC\_BAD\_INSTRUCTION EXC\_I386\_INVOP)

**URL:** <https://forum.opencv.org/t/how-to-use-sift-in-opencv-4-7-0-apple-exc-bad-instruction-exc-i386-invop/13305>\
**Category:** C++\
**Tags:** apple\
**Created:** [May 25, 2023, 12:46pm UTC](https://forum.opencv.org/t/how-to-use-sift-in-opencv-4-7-0-apple-exc-bad-instruction-exc-i386-invop/13305 "2023-05-25T12:46:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dogusbykl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/dogusbykl/32/7950_2.png) [@dogusbykl](https://forum.opencv.org/u/dogusbykl)\
**Post date:** [May 25, 2023, 12:46pm UTC](https://forum.opencv.org/t/how-to-use-sift-in-opencv-4-7-0-apple-exc-bad-instruction-exc-i386-invop/13305/1 "2023-05-25T12:46:52Z")

</div>

```auto
void myFeatureExtractor::extractSIFT(){
    //clone image to be safe
    cv::Ptr<cv::SIFT> myDetector{NULL};
    if (input_image.empty()) {
        std::cout << "Picture couldn't be loaded correctly." << std::endl;
        return;
    }
    cv::Mat myInput = input_image.clone();
    //cv::imshow("Input Image", myInput);
    //cv::waitKey(0);
    myDetector = cv::SIFT::create(); //0,3,0.04,10,1.6
    
    std::vector<cv::KeyPoint> keypoints;
    
    cv::Mat SIFT_output_image;
    
    myDetector->detect(myInput,keypoints);

    // Add results to image and save.
    
    cv::drawKeypoints(myInput, keypoints, SIFT_output_image);
    result_image = SIFT_output_image;
    
};

```

Error:

Thread 1: EXC\_BAD\_INSTRUCTION (code=EXC\_I386\_INVOP, subcode=0x0)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 25, 2023, 1:46pm UTC](https://forum.opencv.org/t/how-to-use-sift-in-opencv-4-7-0-apple-exc-bad-instruction-exc-i386-invop/13305/3 "2023-05-25T13:46:25Z")

</div>

os ? hw ? compiler ? how did you install this ?

is this [somehow apple related](https://github.com/opencv/opencv/issues/23673) ?

---

<div class="post-metadata">

**Author:** ![dogusbykl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/dogusbykl/32/7950_2.png) [@dogusbykl](https://forum.opencv.org/u/dogusbykl)\
**Post date:** [May 25, 2023, 2:10pm UTC](https://forum.opencv.org/t/how-to-use-sift-in-opencv-4-7-0-apple-exc-bad-instruction-exc-i386-invop/13305/4 "2023-05-25T14:10:30Z")

</div>

MacOS Monterey 12.6.3, 1,4 GHz Quad-Core Intel Core i5,  
I am using Xcode  
I installed with Homebrew.  
Most probably it is related to MacOS because other friends using Apple have the same error.

Best,

---

<div class="post-metadata">

**Author:** ![D11](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/d11/32/8992_2.png) [@D11](https://forum.opencv.org/u/D11)\
**Post date:** [October 31, 2023, 10:35am UTC](https://forum.opencv.org/t/how-to-use-sift-in-opencv-4-7-0-apple-exc-bad-instruction-exc-i386-invop/13305/5 "2023-10-31T10:35:09Z")

</div>

Did you manage to solve this problem?
