Opencv開啟一個檔案夾裡面映像

來源:互聯網
上載者:User
// RGBSPLIT.cpp : Defines the entry point for the console application.///*=========================================================================名稱:開啟檔案夾裡面映像時間:2013.08說明:設定num來控制開啟映像數目,要有規律=========================================================================*/#include "stdafx.h"#include "cv.h"#include "highgui.h"char filename[100];//定義一個全域數組型變數,存放圖片名字char windowname[100];//定義一個全域數組型變數,存放視窗名字IplImage* pScr;//頂一個一個全域映像指標,指向迴圈每次載入圖片unsigned char *Readimage(int num);//實現連續讀取圖片的函數int main(int argc, char *argv[]){Readimage(5);//調用連續讀取圖片函數return 0;}unsigned char *Readimage(int num){ for(int i=1;i<=num;i++)//使用迴圈連續讀取檔案夾像 {  sprintf(filename,"./test/%d.jpg",i);//把test裡面照片讀取到filename中  sprintf(windowname,"window%d.jpg",i);//以映像名字命名視窗  pScr=cvLoadImage(filename,1);  cvNamedWindow(windowname,CV_WINDOW_AUTOSIZE);  cvShowImage(windowname,pScr);  } cvWaitKey(0); //銷毀視窗與釋放記憶體 cvReleaseImage(&pScr); cvDestroyAllWindows();  return 0;}

此代碼要設定讀取映像數目

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.