Opencv on MacOS Xcode can not use imread to read image based on c++

asked 2018-10-26 07:12:19 -0500

updated 2018-10-26 07:14:10 -0500

berak gravatar image

I am not sure why I cannot read an image by using imread function and the details about my code are as the following. Please help me. Thank you, everybody!

include <iostream>

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/core/core.hpp"

int main(int argc, const char * argv[]){

cv::Mat scrImage = cv::imread("/Users⁩/zsk⁩/Downloads⁩/zsk.JPEG", CV_LOAD_IMAGE_COLOR);
if(scrImage.empty())
{
    std::cout << "something wrong" << std::endl;
    return -1;
}
cv::Mat scrGray;
cv::cvtColor(scrImage, scrGray, CV_RGB2GRAY);
cv::imshow("scrGray", scrGray);
cv::Mat blurDstImage;
blur(scrGray, blurDstImage, cv::Size(5, 5), cv::Point(-1, 1));
cv::imshow("blurDstImage", blurDstImage);
cv::imwrite("/Users⁩/zsk⁩/Downloads⁩/blurgirl.jpg", blurDstImage);
cv::waitKey(0);
return 0;}

The build information is as the following.

General configuration for OpenCV 3.4.3 ===================================== Version control: unknown

Extra modules: Location (extra): /tmp/opencv-20181001-83194-s618mv/opencv-3.4.3/opencv_contrib/modules Version control (extra): unknown

Platform: Timestamp: 2018-10-01T12:58:23Z Host: Darwin 18.0.0 x86_64 CMake: 3.12.2 CMake generator: Unix Makefiles CMake build tool: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/gmake Configuration: Release

CPU/HW features: Baseline: SSE SSE2 SSE3 SSSE3 requested: DETECT disabled: SSE4_1 SSE4_2 AVX AVX2 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX SSE4_1 (3 files): + SSE4_1 SSE4_2 (1 files): + SSE4_1 POPCNT SSE4_2 FP16 (1 files): + SSE4_1 POPCNT SSE4_2 FP16 AVX AVX (5 files): + SSE4_1 POPCNT SSE4_2 AVX AVX2 (9 files): + SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX512_SKX (1 files): + SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX

C/C++: Built as dynamic libs?: YES C++11: YES C++ Compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ (ver 10.0.0.10001145) C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -DNDEBUG C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG C Compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -DNDEBUG C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Winconsistent-missing-override -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -msse -msse2 -msse3 -mssse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG Linker flags (Release): Linker flags (Debug): ccache ... (more)

edit retag flag offensive close merge delete