Browse Source

fixed

master
zara 3 years ago
parent
commit
3c59b28c0f
  1. 4
      build/CMakeFiles/app0.dir/CXX.includecache
  2. BIN
      build/CMakeFiles/app0.dir/main.cpp.o
  3. BIN
      build/app0
  4. 57
      main.cpp

4
build/CMakeFiles/app0.dir/CXX.includecache

@ -11,6 +11,10 @@ opencv2/opencv.hpp @@ -11,6 +11,10 @@ opencv2/opencv.hpp
/home/zara/WORKSPACE/CPP/app0/opencv2/opencv.hpp
iostream
-
time.h
-
fstream
-
/usr/include/opencv4/opencv2/calib3d.hpp
opencv2/core.hpp

BIN
build/CMakeFiles/app0.dir/main.cpp.o

Binary file not shown.

BIN
build/app0

Binary file not shown.

57
main.cpp

@ -2,23 +2,52 @@ @@ -2,23 +2,52 @@
#include <iostream>
int main(){
cv::VideoCapture cap(0);
std::cout<<"isdfjodjfio"<<std::endl;
cv::VideoWriter writer("app0.mp4",cv::VideoWriter::fourcc('M','P','4','V'),30,cv::Size(1280,720));
cv::Mat image;
int i = 0;
while (cap.read(image))
#include <time.h>
#include <fstream>
void reMap(cv::Mat src, cv::Mat dst, cv::Mat gray, cv::Mat hist)
{
for (int i = 0; i < src.rows * src.cols; i++)
{
cv::imshow("default",image);
writer.write(image);
if(cv::waitKey(20) == 'q'){
break;
if (gray.data[i] == 0)
{
dst.data[i * 3] = 0;
dst.data[i * 3 + 1] = 0;
dst.data[i * 3 + 2] = 0;
}
if(i++>100){
break;
else
{
dst.data[i * 3] = src.data[i * 3] * hist.data[i] / gray.data[i];
dst.data[i * 3 + 1] = src.data[i * 3 + 1] * hist.data[i] / gray.data[i];
dst.data[i * 3 + 2] = src.data[i * 3 + 2] * hist.data[i] / gray.data[i];
}
std::cout<<"i = "<<i<<std::endl;
}
}
int main()
{
cv::VideoCapture cap;
cap.open("/home/zara/让子弹飞.flv");
cv::VideoWriter writer("app0.mp4", cv::VideoWriter::fourcc('m', 'p', '4', 'v'), 30, cv::Size(int(cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_WIDTH)), int(cap.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_HEIGHT))));
cv::Mat image;
cv::Mat gray;
cv::Mat hist;
cv::Mat dst(int(cap.get(4)),int(cap.get(3)),CV_8UC3);
dst.data = (unsigned char *)malloc(int(cap.get(3) * cap.get(4)) * 3);
while (cap.read(image))
{
cv::cvtColor(image, gray, cv::COLOR_RGB2GRAY);
cv::equalizeHist(gray, hist);
reMap(image, dst, gray, hist);
cv::imshow("default",dst);
writer.write(dst);
if (cv::waitKey(2) == 'q')
{
break;
}
}
writer.release();
cap.release();

Loading…
Cancel
Save