opencv--显示一个图片

1.文件名:opencvshowpicture

#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>

using namespace std;
using namespace cv;

int main(int argc,char** argv)
{
    char *inputName  = argv[1];
    cout << "name = " << inputName << endl;
    Mat image = imread( inputName, 1 );//加载
    imshow( inputName, image );//显示图片
    waitKey(0);//等待
    return 0;
}

2.Makefile

CXX ?= g++

CXXFLAGS += -c -Wall $(shell pkg-config --cflags opencv)
LDFLAGS += $(shell pkg-config --libs --static opencv)
name:=opencvshowpicture
all: $(name)

$(name): $(name).o; $(CXX) $< -o $@ $(LDFLAGS)

%.o: %.cpp; $(CXX) $< -o $@ $(CXXFLAGS)

clean: ; rm -f $(name).o $(name)

3.操作步骤

first ∗ ∗ m a k e ; . / o p e n c v s h o w p i c t u r e l e n a . p n g m a k e : N o t h i n g t o b e d o n e f o r ′ a l l ′ . n a m e = l e n a . p n g ∗ ∗ f i r s t ** make;./opencvshowpicture lena.png make: Nothing to be done for &#x27;all&#x27;. name = lena.png **first make;./opencvshowpicturelena.pngmake:Nothingtobedoneforall.name=lena.pngfirst

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值