opencv批量处理图片出现警告 5C

1.代码如下

#include<iostream>
#include<time.h>
#include<opencv2/opencv.hpp>
#include<fstream>

using namespace std;
using namespace cv;

void main()
{
    ifstream file("d:/filelist.txt");

    int img_index = 0;

    while (!file.eof())
    {
        char txt_cont[24];
        file.getline(txt_cont,24);

        char img_file[24],save_file[24];

        sprintf(img_file, "d:/pic2/%s", txt_cont);
        sprintf(save_file, "d:/pic3/%d.jpg", img_index);

        Mat src = imread(img_file);
        Mat crs;
        cvtColor(src,crs,CV_RGB2GRAY);
        img_index++;

        imwrite(save_file,crs);
    }

}

运行完出现了如下警告

图片说明
这是什么意思,该怎么办啊?

2第二种批量处理代码如下

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <vector>
#include <string>
#include <fstream>

using namespace cv;
using namespace std;
int main() 
{
    std::string pattern_jpg = "D:/pic2/*.png";
    std::string savefile="D:/pic3";
    std::vector<cv::String> image_files;
    cv::glob(pattern_jpg, image_files);

    for (unsigned int frame = 0; frame < image_files.size(); ++frame) //image_file.size()代表文件中总共的图片个数
    {
        Mat image = cv::imread(image_files[frame]);
        Mat dst;
        cvtColor(image,dst,CV_RGB2GRAY);
        imshow("1",dst);
        imwrite(savefile,dst);

        waitKey(30);
    }


}

出现了相同警告,请问该如何修改?
谢谢。

1个回答

文件路径应该是"\"而不是“/"吧。而且字符串中要注意转义符的问题”D:\pic2\*.png"。
可能跟这个有关

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
opencv批量处理图片出现的一个警告
用opencv批量处理一个文件夹里的图片,运行完会出现一个警告,帮忙看一下该怎么修改,谢谢。rn```rn#includern#includern#includern#includern rnusing namespace std;rnusing namespace cv;rn rnvoid main()rnrn ifstream file("d:/filelist.txt");rn rn int img_index = 0;rn rn while (!file.eof())//当文件没有读到末尾继续循环rn rn char txt_cont[24];rn file.getline(txt_cont,24);rn rn char img_file[24],save_file[24];rn rn sprintf(img_file, "d:/pic2/%s", txt_cont);rn sprintf(save_file, "d:/pic3/%d.jpg", img_index);rn rn Mat src = imread(img_file);rn Mat crs;rn cvtColor(src,crs,CV_RGB2GRAY);rn img_index++;rn rn imwrite(save_file,crs);rn rn rnrn```rnrn![图片说明](https://img-ask.csdn.net/upload/201903/11/1552268238_638343.png)rn
opencv——批量处理图片并保存
           背景:某文件夹X下有若干张图片,对每一张图片进行处理,将处理后的图片保存至新的文件夹Y下。#include &amp;lt;opencv2/core/core.hpp&amp;gt; #include &amp;lt;opencv2/highgui/highgui.hpp&amp;gt; #include &amp;lt;opencv2/imgproc/imgproc.hpp&amp;gt; #include &amp;lt;io...
图片批量处理|批量处理图片软件
---------图片批量处理|批量处理图片软件 ---------
基于OpenCV批量处理文件夹中的图片的方法
在进行图像处理等问题是面临的一个问题是如何批量的处理图片,这些图片存在在一个文件夹中,如何对这个文件夹中的数据进行批处理是非常重要的,下面介绍几种常用的方法。1. sprintf()函数法这种方法最为简单,他是将路径的名字存放在一个数组中//input为输入文件夹的路径,i为第几幅图像 //图像的命名格式都是1.jpg,2.jpg,... sprintf(filename, "%s\\%d.jpg"
OpenCV 应用读取文件路径与文件名批量处理图片
在应用opencv大量测试图片时,需要对图片批量的读入并进行处理。之前处理这个问题时是使用这种方法:把待处理的图片放到一个文件夹内,全选它们然后重命名1,这样系统会自动给他们全部重命名为1(1),1(2),1(3)等等等 然后用下面的代码把图片读进来:
图片批量处理
有时图片大小,不能上传到网上,这个小工具可以批量修改图片的大小。
iSee图片批量处理 V1.0.iSee图片批量处理 V1.0.
iSee图片批量处理 V1.0.iSee图片批量处理 V1.0.iSee图片批量处理 V1.0.iSee图片批量处理 V1.0.
批量处理图片
批量处理图片,快速生成质量高,文件小的图片。JPG输出。
用OpenCV批量处理图像
分享一点应用OpenCV的小经验。有很多时候,我们需要对一个文件夹内的所有图像进行处理,这时一张张的Ctrl+F5就让人太蛋疼了,所以就产生了图像批量处理。文档里有原码哟。
【OpenCV】批量处理图片尺寸-64*64
使用的话修改对应的路径,和图片生成的位置。 #include <cv.h> #include <highgui.h> #include<io.h> #include <string.h> using namespace std; using namespace cv; char * filePath = "E:\\一";void getFiles(string path, vect
iSee图片批量处理工具
比较好用的一种图片处理工具,尤其适合做图片批量处理,如统一修改图片尺寸、文件大小等。可以自动升级。
图片批量处理工具
图片批量处理软件, 批量改图片大小,给图片加水印,图片调整等
迷你图片批量处理工具
迷你图片批量处理工具
word2007_批量处理图片编号
适用于编制的文档中号大量的图或表的Word,方便简洁,如有修改可批量处理
matlab 批量处理图片
一、基本上比较常用的就是自己的图片命名是规律的,这样可以快速循环处理: str='D:\'; %我的图像放在D盘,做差文件夹下,好的图像文件夹下 for i=1:12 I=imread([str,num2str(i),'.png']); %依次读取每一幅图像 %在此处进行你的图像处理即可 en
图片批量处理工具v6.3
图片批量处理工具v6.3 可以处理图片,批处理
如何批量处理图片
如何批量处理图片
文件夹下批量处理图片
c++指定文件夹目录,批量处理该目录下所有图片,利用opencv进行处理,环境简单,能生成序列文件名及修改后缀
批量处理图片软件(珍藏版)
很好用的一款软件,使用起来非常好用,希望大家喜欢!
winforms图片批量处理
winforms 图片批量处理 .
cv2 python 图片的批量处理
最近要生成大批量图片来进行样本准备,处理图片除了用ffmpeg外,cv2也是个不错的工具。 通过cv2 生成大量图片。 炸弹,单个目录生成了40G的图片,所有图片放入一个输出目录存在读取问题,最终格式化了磁盘。 # encoding:utf-8 import os import cv2 as cv import imghdr import time import os #扫描输出图片列
随心图片批量处理 v2.1.zip
随心图片批量处理的主要功能是在电商、数字化图书、文字识别等行业中,对大量图片或照片进行批量添加水印、缩放、截取、旋转与颜色等处理功能,充分提高大量图片或照片的处理效率,减轻人工处理的工作量,提高工作效率并节约成本。随心图片批量处理界面清爽,操作简单,易于使用。 随心图片批量处理的主要功能特征: 支持批量缩放处理图片; 支持JPG、BMP、PNG图片格式; 支持文字与图片水印; 支持批量文件大小处理; 支持批量转换为JPG格式; 支持批量图片截取; 支持图片等比缩放; 支持批量修改图片颜色; 支持批量图片旋转; 支持批量操作时人工确认; 自动保存最近一次的操作参数; 支持多种语言; 绿色软件,拷贝即可使用; 随心图片批量处理截图:
图片批量处理工具-ImageBatchKing
png图片批量处理工具-ImageBatchKing 批量处理,,我只是搬运工,勿喷!
图片批量处理小工具.rar
图片批量处理的小工具, 批量改图片尺寸 格式 色调 等等.......
ImageMagick图片批量处理
Version: ImageMagick 6.7.6-7 2012-04-20 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC Features: OpenMP Usage: convert.exe [options ...] file [ [options ...] file ...] [options ...] file Image Settings: -adjoin join images into a single multi-image file -affine matrix affine transform matrix -alpha option activate, deactivate, reset, or set the alpha channel -antialias remove pixel-aliasing -authenticate password decipher image with this password -attenuate value lessen (or intensify) when adding noise to an image -background color background color -bias value add bias when convolving an image -black-point-compensation use black point compensation -blue-primary point chromaticity blue primary point -bordercolor color border color -caption string assign a caption to an image -channel type apply option to select image channels -colors value preferred number of colors in the image -colorspace type alternate image colorspace -comment string annotate image with comment -compose operator set image composite operator -compress type type of pixel compression when writing the image -define format:option define one or more image format options -delay value display the next image after pausing -density geometry horizontal and vertical density of the image -depth value image depth -direction type render text right-to-left or left-to-right -display server get image or font from this X server -dispose method layer disposal method -dither method apply error diffusion to image -encoding type text encoding type -endian type endianness (MSB or LSB) of the image -family name render text with this font family -fill color color to use when filling a graphic primitive -filter type use this filter when resizing an image -font name render text with this font -format "string" output formatted image characteristics -fuzz distance colors within this distance are considered equal -gravity type horizontal and vertical text placement -green-primary point chromaticity green primary point -intent type type of rendering intent when managing the image color -interlace type type of image interlacing scheme -interline-spacing value set the space between two text lines -interpolate method pixel color interpolation method -interword-spacing value set the space between two words -kerning value set the space between two letters -label string assign a label to an image -limit type value pixel cache resource limit -loop iterations add Netscape loop extension to your GIF animation -mask filename associate a mask with the image -mattecolor color frame color -monitor monitor progress -orient type image orientation -page geometry size and location of an image canvas (setting) -ping efficiently determine image attributes -pointsize value font point size -precision value maximum number of significant digits to print -preview type image preview type -quality value JPEG/MIFF/PNG compression level -quiet suppress all warning messages -red-primary point chromaticity red primary point -regard-warnings pay attention to warning messages -remap filename transform image colors to match this set of colors -respect-parentheses settings remain in effect until parenthesis boundary -sampling-factor geometry horizontal and vertical sampling factor -scene value image scene number -seed value seed a new sequence of pseudo-random numbers -size geometry width and height of image -stretch type render text with this font stretch -stroke color graphic primitive stroke color -strokewidth value graphic primitive stroke width -style type render text with this font style -synchronize synchronize image to storage device -taint declare the image as modified -texture filename name of texture to tile onto the image background -tile-offset geometry tile offset -treedepth value color tree depth -transparent-color color transparent color -undercolor color annotation bounding box color -units type the units of image resolution -verbose print detailed information about the image -view FlashPix viewing transforms -virtual-pixel method virtual pixel access method -weight type render text with this font weight -white-point point chromaticity white point Image Operators: -adaptive-blur geometry adaptively blur pixels; decrease effect near edges -adaptive-resize geometry adaptively resize image using 'mesh' interpolation -adaptive-sharpen geometry adaptively sharpen pixels; increase effect near edges -alpha option on, activate, off, deactivate, set, opaque, copy transparent, extract, background, or shape -annotate geometry text annotate the image with text -auto-gamma automagically adjust gamma level of image -auto-level automagically adjust color levels of image -auto-orient automagically orient (rotate) image -bench iterations measure performance -black-threshold value force all pixels below the threshold into black -blue-shift factor simulate a scene at nighttime in the moonlight -blur geometry reduce image noise and reduce detail levels -border geometry surround image with a border of color -bordercolor color border color -brightness-contrast geometry improve brightness / contrast of the image -cdl filename color correct with a color decision list -charcoal radius simulate a charcoal drawing -chop geometry remove pixels from the image interior -clamp restrict pixel range from 0 to the quantum depth -clip clip along the first path from the 8BIM profile -clip-mask filename associate a clip mask with the image -clip-path id clip along a named path from the 8BIM profile -colorize value colorize the image with the fill color -color-matrix matrix apply color correction to the image -contrast enhance or reduce the image contrast -contrast-stretch geometry improve contrast by `stretching' the intensity range -convolve coefficients apply a convolution kernel to the image -cycle amount cycle the image colormap -decipher filename convert cipher pixels to plain pixels -deskew threshold straighten an image -despeckle reduce the speckles within an image -distort method args distort images according to given method ad args -draw string annotate the image with a graphic primitive -edge radius apply a filter to detect edges in the image -encipher filename convert plain pixels to cipher pixels -emboss radius emboss an image -enhance apply a digital filter to enhance a noisy image -equalize perform histogram equalization to an image -evaluate operator value evaluate an arithmetic, relational, or logical expression -extent geometry set the image size -extract geometry extract area from image -fft implements the discrete Fourier transform (DFT) -flip flip image vertically -floodfill geometry color floodfill the image with color -flop flop image horizontally -frame geometry surround image with an ornamental border -function name parameters apply function over image values -gamma value level of gamma correction -gaussian-blur geometry reduce image noise and reduce detail levels -geometry geometry preferred size or location of the image -identify identify the format and characteristics of the image -ift implements the inverse discrete Fourier transform (DFT) -implode amount implode image pixels about the center -lat geometry local adaptive thresholding -layers method optimize, merge, or compare image layers -level value adjust the level of image contrast -level-colors color,color level image with the given colors -linear-stretch geometry improve contrast by `stretching with saturation' -liquid-rescale geometry rescale image with seam-carving -median geometry apply a median filter to the image -mode geometry make each pixel the 'predominant color' of the neighborhood -modulate value vary the brightness, saturation, and hue -monochrome transform image to black and white -morphology method kernel apply a morphology method to the image -motion-blur geometry simulate motion blur -negate replace every pixel with its complementary color -noise geometry add or reduce noise in an image -normalize transform image to span the full range of colors -opaque color change this color to the fill color -ordered-dither NxN add a noise pattern to the image with specific amplitudes -paint radius simulate an oil painting -polaroid angle simulate a Polaroid picture -posterize levels reduce the image to a limited number of color levels -profile filename add, delete, or apply an image profile -quantize colorspace reduce colors in this colorspace -radial-blur angle radial blur the image -raise value lighten/darken image edges to create a 3-D effect -random-threshold low,high random threshold the image -region geometry apply options to a portion of the image -render render vector graphics -repage geometry size and location of an image canvas -resample geometry change the resolution of an image -resize geometry resize the image -roll geometry roll an image vertically or horizontally -rotate degrees apply Paeth rotation to the image -sample geometry scale image with pixel sampling -scale geometry scale the image -segment values segment an image -selective-blur geometry selectively blur pixels within a contrast threshold -sepia-tone threshold simulate a sepia-toned photo -set property value set an image property -shade degrees shade the image using a distant light source -shadow geometry simulate an image shadow -sharpen geometry sharpen the image -shave geometry shave pixels from the image edges -shear geometry slide one edge of the image along the X or Y axis -sigmoidal-contrast geometry increase the contrast without saturating highlights or shadows -sketch geometry simulate a pencil sketch -solarize threshold negate all pixels above the threshold level -sparse-color method args fill in a image based on a few color points -splice geometry splice the background color into the image -spread radius displace image pixels by a random amount -statistic type geometry replace each pixel with corresponding statistic from the neighborhood -strip strip image of all profiles and comments -swirl degrees swirl image pixels about the center -threshold value threshold the image -thumbnail geometry create a thumbnail of the image -tile filename tile image when filling a graphic primitive -tint value tint the image with the fill color -transform affine transform image -transparent color make this color transparent within the image -transpose flip image vertically and rotate 90 degrees -transverse flop image horizontally and rotate 270 degrees -trim trim image edges -type type image type -unique-colors discard all but one of any pixel color -unsharp geometry sharpen the image -vignette geometry soften the edges of the image in vignette style -wave geometry alter an image along a sine wave -white-threshold value force all pixels above the threshold into white Image Sequence Operators: -append append an image sequence -clut apply a color lookup table to the image -coalesce merge a sequence of images -combine combine a sequence of images -composite composite image -crop geometry cut out a rectangular region of the image -deconstruct break down an image sequence into constituent parts -evaluate-sequence operator evaluate an arithmetic, relational, or logical expression -flatten flatten a sequence of images -fx expression apply mathematical expression to an image channel(s) -hald-clut apply a Hald color lookup table to the image -morph value morph an image sequence -mosaic create a mosaic from an image sequence -print string interpret string and print to console -process arguments process the image with a custom image filter -separate separate an image channel into a grayscale image -smush geometry smush an image sequence together -write filename write images to this file Image Stack Operators: -clone indexes clone an image -delete indexes delete the image from the image sequence -duplicate count,indexes duplicate an image one or more times -insert index insert last image into the image sequence -reverse reverse image sequence -swap indexes swap two images in the image sequence Miscellaneous Options: -debug events display copious debugging information -help print program options -list type print a list of supported option arguments -log format format of debugging information -version print version information By default, the image format of `file' is determined by its magic number. To specify a particular image format, precede the filename with an image format name and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). Specify 'file' as '-' for standard input or output.
ImageTuner5.0(图片批量处理)
这是一个用于批处理图片的小工具
图片批量处理JPEG_Resizer
JPEG_Resizer,批量处理,图片处理,做网页常用的工具,好东东拿来分享
图片批量处理脚本文件
批量图片处理脚本 PNG 批量图片处理脚本 PNG批量图片处理脚本 PNG
python代码批量处理图片resize
出差做PPT,要放一些图片上去,原图太大必须resize,十几张图片懒得一一处理了,最近正好在学python,最好的学习方式就是使用,于是写了一个批量处理图片resize的代码,在写的过程中,熟悉了python自己的os模块和opencv的cv2模块。 代码如下 // python code import os import cv2 ''' 设置图片路径,该路径下包含了14张jpg格式的照片,名字...
淘宝图片批量处理
淘宝图片批量处理
图片批量处理 助手
图片批量处理 助手 处理图片非常好用。 批量处理大量图片
linux批量处理图片
有时候我们需要对很多的图片或文件进行处理,如数据集,如果一个一个图片处理就会非常麻烦,这时候我们可以采用批量操作。linux 自带的ImageMagick能够很方便地对图片进行批量处理,比如,批量图片格式转换,大小转换等等。在这里记录一下如何将成千上万的xxx.TIF文件(标签图像文件格式)批量转换成对应的xxx.png格式。因为自己用到了双三次下采样(上采用同),所以也记录了。 先在终端进入...
python 批量处理图片程序
如果需要源代码,请留言 功能:自动循环访问文件夹内图片文件,获取exit信息并保存至excel,图片重命名
java -- 批量处理图片
用python 写好了 老大说不行,服务器环境不让加,只能用java在写一个 辛辛苦苦花了2个小时,才写出来, io 这一块也学习了学习 代码分享出来。 需求: 一个文件下面有很多子目录,要把这个文件下面的所有图片都整合到一个文件里面,这个文件只能放1W张,默认名字为20170816001  年月日编号001 超过1W张 照片放到第二个文件里面 也就是 002 20170816002
easy-image-modifier 图片批量处理
可以对图片批量处理,简单方便快速,其实不一定是针对android,不管什么开发,用到图片的时候都要对图片进行处理,这款就是很简单的对图片更改的应用
批量处理图片工具
批量处理图片工具,可批量处理太量图片,转换格式
PS如何批量处理图片
PS如何批量处理图片,如批量调整、压缩等功能利用
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件