Image Processing with CUDA

프로그래밍/CUDA 2015. 7. 28. 02:39

  

    Cuda_ex1.zip




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// main.cpp
 
#include <cv.hpp>
#include "kernel.h"
using namespace cv;
 
int main()
{
    // Open a webcamera
    VideoCapture camera(0);
    Mat frame;
    if (!camera.isOpened()) 
        return -1;
    
    camera >> frame;
 
    // create CPU/GPU shared images - one for the initial and one for the result
    Mat sGray(frame.size(),CV_8U,createImageBuffer(frame.size().width * frame.size().height));
    Mat dGray(frame.size(),CV_8U,createImageBuffer(frame.size().width * frame.size().height));
    Mat eGray(frame.size(),CV_8U,createImageBuffer(frame.size().width * frame.size().height));
    cvtColor(frame, dGray, CV_BGR2GRAY);
    cvtColor(frame, eGray, CV_BGR2GRAY);
 
    // Create the capture windows
    namedWindow("Source");
    namedWindow("Greyscale");
    namedWindow("Blurred");
    namedWindow("Sobel");
    
    char c;
 
    // Loop while capturing images
    while (1)
    {
        // Capture the image and store a gray conversion for the gpu
        camera >> frame;
        cv::cvtColor(frame, sGray, CV_BGR2GRAY);
        
        boxfilter(frame.size().width, frame.size().height, sGray.data, dGray.data, 33);
        //boxfilterCPU(frame.size().width, frame.size().height, sGray.data, dGray.data, 3, 3);
        sobelfilter(frame.size().width, frame.size().height, dGray.data, eGray.data);
 
        // Show the results
        cv::imshow("Source", frame);
        cv::imshow("Greyscale", sGray);
        cv::imshow("Blurred", dGray);
        cv::imshow("Sobel", eGray);
 
        c = cv::waitKey(10);
        
        if (c == 27)
            break;
    }
 
    // Exit
    destroyImageBuffer(sGray.data);
    destroyImageBuffer(dGray.data);
    destroyImageBuffer(eGray.data);
 
    return 0;
}
 
cs


1
2
3
4
5
6
7
8
9
10
11
12
13
14
// kernel.h
 
#ifndef _KERNEL_H_
#define _KERNEL_H_
 
#include <iostream>
 
void boxfilter(int iw, int ih, unsigned char *source, unsigned char *dest, int bw, int bh);
void boxfilterCPU(int iw, int ih, unsigned char *src, unsigned char *dst, int bw, int bh);
void sobelfilter(int iw, int ih, unsigned char *source, unsigned char *dest);
 
unsigned char* createImageBuffer(unsigned int bytes);
void           destroyImageBuffer(unsigned char* bytes);
#endif
cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include "kernel.h"
 
void boxfilterCPU(int iw, int ih, unsigned char *src, unsigned char *dst, int bw, int bh)
{
    for (int m = 0; m < ih; m++)
    {
        for (int n = 0; n < iw; n++)
        {
            int count = 0;
            float sum = 0.0;
 
            for (int j = -(bh / 2); j <= (bh / 2); j++)
            {
                for (int i = -(bw / 2); i <= (bw / 2); i++)
                {
                    // Verify that this offset is within the image boundaries
                    if ((n + i) < iw && (n + i) >= 0 && (m + j) < ih && (m + j) >= 0)
                    {
                        sum += (float)src[((m + j) * iw) + (n + i)];
                        count++;
                    }
                }
            }
 
            // Average the sum
            sum /= (float)count;
            dst[(m * iw) + n] = (unsigned char)sum;
        }
    }
}
 
__global__ void boxfilter_kernel(int iw, int ih, unsigned char *source, unsigned char *dest, int bw, int bh)
{
    // Calculate our pixel's location
    int x = (blockIdx.x * blockDim.x) + threadIdx.x;
    int y = (blockIdx.y * blockDim.y) + threadIdx.y;
 
    // Variables to store the sum
    int count = 0;
    float sum = 0.0;
 
    // Do the blur operation by summing the surround pixels
    for (int j = -(bh / 2); j <= (bh / 2); j++)
    {
        for (int i = -(bw / 2); i <= (bw / 2); i++)
        {
            // Verify that this offset is within the image boundaries
            if ((x + i) < iw && (x + i) >= 0 && (y + j) < ih && (y + j) >= 0)
            {
                sum += (float)source[((y + j) * iw) + (x + i)];
                count++;
            }
        }
    }
 
    // Average the sum
    sum /= (float)count;
    dest[(y * iw) + x] = (unsigned char)sum;
}
 
__global__ void sobelfilter_kernel(int iw, int ih, unsigned char *source, unsigned char *dest)
{
    // Calculate our pixel's location
    int x = (blockIdx.x * blockDim.x) + threadIdx.x;
    int y = (blockIdx.y * blockDim.y) + threadIdx.y;
 
    // Operate only if we are in the correct boundaries
    if (x > 0 && x < iw - 1 && y > 0 && y < ih - 1)
    {
        int gx = -source[iw*(y - 1+ (x - 1)] + source[iw*(y - 1+ (x + 1)] +
            -2 * source[iw*(y)+(x - 1)] + 2 * source[iw*(y)+(x + 1)] +
            -source[iw*(y + 1+ (x - 1)] + source[iw*(y + 1+ (x + 1)];
        int gy = -source[iw*(y - 1+ (x - 1)] - 2 * source[iw*(y - 1+ (x)]
            - source[iw*(y - 1+ (x + 1)] +
            source[iw*(y + 1+ (x - 1)] + 2 * source[iw*(y + 1+ (x)] +
            source[iw*(y + 1+ (x + 1)];
        dest[iw*+ x] = (int)sqrt((float)(gx)*(float)(gx)+(float)(gy)*(float)(gy));
    }
}
 
 
 
 
void boxfilter(int iw, int ih, unsigned char *source, unsigned char *dest, int bw, int bh)
{
    // allocate memory for the bitmap in GPU memory
    unsigned char *dev_source, *dev_dest;
    cudaHostGetDevicePointer(&dev_source, source, 0);
    cudaHostGetDevicePointer(&dev_dest, dest, 0);
 
    //cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags()
 
    // Run the boxfilter kernel
    dim3 blocks(iw / 16, ih / 16);
    dim3 threads(1616);
    
    // Execute the kernel
    boxfilter_kernel << <blocks, threads >> >(iw, ih, dev_source, dev_dest, bw, bh);
    cudaThreadSynchronize();
}
 
void sobelfilter(int iw, int ih, unsigned char *source, unsigned char *dest)
{
    // allocate memory for the bitmap in GPU memory
    unsigned char *dev_source, *dev_dest;
    cudaHostGetDevicePointer(&dev_source, source, 0);
    cudaHostGetDevicePointer(&dev_dest, dest, 0);
 
    // Run the boxfilter kernel
    dim3 blocks(iw / 16, ih / 16);
    dim3 threads(1616);
 
    // Execute the kernel
    sobelfilter_kernel << <blocks, threads >> >(iw, ih, dev_source, dev_dest);
    cudaThreadSynchronize();
}
 
unsigned char* createImageBuffer(unsigned int bytes)
{
    unsigned char *ptr = NULL;
    cudaSetDeviceFlags(cudaDeviceMapHost);
    cudaHostAlloc(&ptr, bytes, cudaHostAllocMapped);
    return ptr;
}
 
void destroyImageBuffer(unsigned char* bytes)
{
    cudaFreeHost(bytes);
}
cs



'프로그래밍 > CUDA' 카테고리의 다른 글

CUDA 스레드 구조  (0) 2014.12.06
CUDA 기본 문법 정리  (0) 2014.12.06

CVPR 2015 Code List

카테고리 없음 2015. 7. 26. 02:58

글자수 제한 같은거 있어서 짤릴지 모르겠는데, 암튼 올려 봅니다.

학생들에게 논문은 두 종류로 나뉘죠. 소스코드가 있는 것과 그렇지 않은 걸로....

cvpr 2015 논문 중에서 소스코드가 있는 것들만 추려 봤는데, 다는 못 찾은 거 같고 절반 이상은 찾은 거 같습니다.

이미 공개된 것과 공개 예정인 것으로 나눠봤습니다. 

논문에는 공개했다고 써놓고, 실제로 사이트 가보면 coming soon이라고 되있는 것들도 꽤 있네요.

========================================================

이미 공개

Andelo Martinovic et. al.
3D All The Way: Semantic Segmentation of Urban Scenes From Start to End in 3D
https://bitbucket.org/amartino/facade3d

Z. Wu, S. Song, A. Khosla, F. Yu, L. Zhang, X. Tang and J. Xiao
3D ShapeNets: A Deep Representation for Volumetric Shape Modeling
http://3dshapenets.cs.princeton.edu/3DShapeNetsCode.zip

Sebastian Haner, Kalle Åström
Absolute Pose for Cameras Under Flat Refractive Interfaces
http://github.com/sebhaner/refractive_pose

Hae-Gon Jeon, Jaesik Park, Gyeongmin Choe, Jinsun Park, Yunsu Bok, Yu-Wing Tai and In So Kweon
Accurate Depth Map Estimation from a Lenslet Light Field Camera
https://drive.google.com/…/0B2553ggh3QTcS01zU0RjOG5FTjQ/view

Christoph Käding, Alexander Freytag, Erik Rodner, Paul Bodesheim, and Joachim Denzler
Active Learning and Discovery of Object Categories in the Presence of Unnameable Instances
https://github.com/cvjena/

Epameinondas Antonakos, Joan Alabort-i-Medina, Stefanos Zafeiriou
Active Pictorial Structures
http://www.menpo.org/

Fabian Caba Heilbron, Victor Escorcia, Bernard Ghanem and Juan Carlos Niebles
ActivityNet: A Large-Scale Video Benchmark for Human Activity Understanding
http://activity-net.org

David Perra, Rohit Kumar Gupta, Jan-Micheal Frahm
Adaptive Eye-Camera Calibration for Head-Worn Devices
http://cs.unc.edu/~jmf/publications/gaze_release.7z

Neel Shah, Vladimir Kolmogorov and Christoph H. Lampert.
A Multi-Plane Block-Coordinate Frank-Wolfe Algorithm for Training Structural SVMs with a Costly max-Oracle.
http://pub.ist.ac.at/~vnk/software/SVM-v1.02.zip

Bo Xin, Yuan Tian, Yizhou Wang, Wen Gao
Background Subtraction via Generalized Fused Lasso Foreground Modeling
http://idm.pku.edu.cn/st…/wangyizhou/code/code_bs_cvpr15.rar

Peixian Chen, Naiyan Wang, Nevin L. Zhang, and Dit-Yan Yeung. 
Bayesian adaptive matrix factorization with automatic model selection 
http://peixianc.me/amf_codes.zip

Tali Dekel, Shaul Oron, Michael Rubinstein, Shai Avidan, William T. Freeman
Best-Buddies Similarity for Robust Template Matching
http://people.csail.mit.edu/…/BBS_code_and_data_release_v1.…

Balntas, Vassileios and Tang, Lilian and Mikolajczyk, Krystian,
BOLD - Binary Online Learned Descriptor For Efficient Image Matching,
https://github.com/vbalnt/bold

C. Xu, S.-H. Hsieh, C. Xiong, and J. J. Corso. 
Can humans fly? Action understanding with multiple classes of actors
http://web.eecs.umich.edu/~jjcorso/r/a2d/

amélie royer, christoph h. lampert. 
"classifier adaptation at prediction time"
http://pub.ist.ac.at/…/Classifier_Adaptation_At_Prediction_…

Nebehay, Georg and Pflugfelder, Roman
Clustering of Static-Adaptive Correspondences for Deformable Object Tracking
https://github.com/gnebehay/CppMT

Xiao, Yao and Lu, Cewu and Tsougenis, Efstratios and Lu, Yongyi and Tang, Chi-Keung,
Complexity-Adaptive Distance Metric for Object Proposals Generation
http://www.cse.ust.hk/~yxiaoab/cvpr2015/files/Release.zip

Chris Sweeney Laurent Kneip Tobias H¨ollerer Matthew Turk
Computing Similarity Transformations from Only Image Correspondences
http://cs.ucsb.edu/~cmsweeney/theia/

Seungryung Kim, Dongbo Min, Bumsub Ham, Seungchul Ryu, Minh N. Do, and Kwanghoon Sohn,
DASC: Dense Adaptive Self-Correlation Descriptor for Multi-modal and Multi-spectral Correspondence
http://seungryong.github.io/…/DASCdescriptor_CVPR2015_v1.0.…

Nguyen A, Yosinski J, Clune J. 
"Deep Neural Networks are Easily Fooled: High Confidence Predictions for Unrecognizable Images".
https://github.com/Evolving-AI-Lab/fooling

Andrej Karpathy, Li Fei-Fei
Deep Visual-Semantic Alignments for Generating Image Descriptions
https://github.com/karpathy/neuraltalk

Fatma Güney and Andreas Geiger
Displets: Resolving Stereo Ambiguities using Object Knowledge
http://www.cvlibs.net/projects/displets/

J. Dong and S. Soatto. 
Domain-Size Pooling in Local Descriptors: DSP-SIFT.
http://vision.ucla.edu/~jingmi…/…/dsp/dsp_toolbox_v0.0.2.zip

Wulff and Black, 
"Efficient Sparse-to-Dense Optical Flow Estimation using a Learned Basis and Layers
https://github.com/jswulff/pcaflow

Philippe Weinzaepfel, Jerome Revaud, Zaid Harchaoui and Cordelia Schmid
EpicFlow: Edge-Preserving Interpolation of Correspondences for Optical Flow
http://pascal.inrialpes.fr/…/epicf…/files/EpicFlow_v1.00.zip

Yan Li et. al.
Face Video Retrieval with Image Query via Hashing across Euclidean Space and Riemannian Manifold
http://vipl.ict.ac.cn/resources/codes

Jon Long, Evan Shelhamer, Trevor Darrell
Fully Convolutional Networks for Semantic Segmentation
http://www.cs.berkeley.edu/~jonlong/

Xiangyu Zhu, Zhen Lei, Junjie Yan, Dong Yi, Stan Z. Li, 
“High-Fidelity Pose and Expression Normalization for Face Recognition in the Wild”
http://www.cbsr.ia.ac.cn/…/xiangyuzhu/projects/HPEN/main.htm

S. H. Khatoonabadi, N. Vasconcelos, I. V. Bajić, and Y. Shan, 
How many bits does it take for a stimulus to be salient?"
http://mcl.ensc.sfu.ca/software/kvbs_cvpr2015.rar
http://www.svcl.ucsd.edu/projects/hossein/kvbs_cvpr2015.rar

Yuting Zhang, Kihyuk Sohn, Ruben Villegas, Gang Pan, Honglak Lee, 
Improving Object Detection with Deep Convolutional Networks via Bayesian Optimization and Structured Prediction
https://github.com/YutingZhang/fgs-obj

Hoo-Chang Shin Le Lu Lauren Kim Ari Seff Jianhua Yao Ronald M. Summers
Interleaved Text/Image Deep Mining on a Large-Scale Radiology Database
https://github.com/rsummers11/CADLab

A. Milan, L. Leal-Taixe, K. Schindler and I. Reid
Joint Tracking and Segmentation of Multiple Targets
https://bitbucket.org/amilan/segtracking

Ganzhao Yuan, and Bernard Ghanem. 
l0TV: A New Method for Image Restoration in the Presence of Impulse Noise.
http://yuanganzhao.weebly.com/uploa…/…/7/5/10759809/l0tv.zip

D. Sun, E. B. Sudderth, and H. Pfister 
Layered RGBD Scene Flow Estimation
http://people.seas.harvard.edu/…/2015/rgbd_layered_flow_cod…

Sergey Zagoruyko, Nikos Komodakis, 
Learning to Compare Image Patches via Convolutional Neural Networks"
https://github.com/szagoruyko/cvpr15deepcompare

Jeff Donahue et. al.
Long-term Recurrent Convolutional Networks for Visual Recognition and Description},
http://jeffdonahue.com/lrcn/

A. Shekhovtsov, P. Swoboda and B. Savchynskyy
Maximum Persistency via Iterative Relaxed Inference with Graphical Models
http://cmp.felk.cvut.cz/~shekhovt/persistency/

Zhibin Hong, Zhe Chen, Chaohui Wang, Xue Mei, Danil Prokhorov, and Dacheng Tao
MUlti-Store Tracker (MUSTer): a Cognitive Psychology Inspired Approach to Object Tracking", 
https://sites.google.com/…/multistore…/MUSTer_code_v1.1.zip…

Visesh Chari Simon Lacoste-Julieny Ivan Laptev Josef Sivic
On Pairwise Costs for Network Flow Multi-Object Tracking
https://github.com/viseshchari/TrackingNetFlow

Shengcai Liao, Yang Hu, Xiangyu Zhu, and Stan Z. Li, 
"Person Re-identification by Local Maximal Occurrence Representation and Metric Learning."
http://www.cbsr.ia.ac.cn/users/scliao/projects/lomo_xqda/

Ijaz Akhter and Michael J. Black
Pose-Conditioned Joint Angle Limits for 3D Human Pose Reconstruction
http://poseprior.is.tue.mpg.de/

G. Tzimiropoulos, 
"Project-Out Cascaded Regression with an application to Face Alignment",
https://www.dropbox.com/s/wtiuv36lji6ds60/po_cr_code_v1.zip…

YiChang Shih, Dilip Krishnan, Fredo Durand, William T. Freeman
Reflection Removal Using Ghosting Cues
https://www.dropbox.com/s/gah3aw…/dereflection_06102015.zip…

B. Ham, M. Cho, J. Ponce
Robust Image Filtering Using Joint Static and Dynamic Guidance
http://www.di.ens.fr/…/sdfil…/code/sdfilter-release-v1.1.zip

Changyang Li, Yuchen Yuan, Weidong Cai1, Yong Xia, and David Dagan Feng
Robust Saliency Detection via Regularized Random Walks Ranking
http://sydney.edu.au/…/~y…/cvpr2015/rrwr_matlab_cvpr2015.zip

W. Wang, J. Shen, F. Porikli, 
Saliency-aware geodesic video object segmentation, 
https://github.com/shenjianbing/SaliencySeg

Yin Wang, Caglayan Dicle, Mario Sznaier and Octavia Camps
Self Scaled Regularized Robust Regression
http://robustsystems.coe.neu.edu/…/sys…/code/CVPR15_S2R3.zip

Jia-Bin Huang, Abhishek Singh, and Narendra Ahuja, 
Single Image Super-Resolution from Transformed Self-Exemplars
https://github.com/jbhuang0604/SelfExSR

Fang Wang, Le Kang, and Yi Li
Sketch-based 3D Shape Retrieval using Convolutional Neural Networks
http://users.cecs.anu.edu.au/~yili/cnnsbsr/

Julian Straub, Trevor Campbell, Jonathan P. How, John W. Fisher III. 
"Small-Variance Nonparametric Clustering on the Hypersphere"
https://github.com/jstraub/dpMMlowVar

Yan Xia, Kaiming He, Pushmeet Kohli, and Jian Sun
Sparse Projections for High-Dimensional Binary Codes
http://research.microsoft.com/…/people/kahe/cvp…/spbe_v1.zip

Fumin Shen, Chunhua Shen, Wei Liu, Heng Tao Shen, 
"Supervised Discrete Hashing"
https://github.com/bd622/DiscretHashing

Zuffi, Silvia and Black, Michael J.
The Stitched Puppet: A Graphical Model of 3D Human Shape and Pose,
http://stitch.is.tue.mpg.de/pre_download

Y. Verdie, K. M. Yi, P. Fua, and V. Lepetit. 
"TILDE: A Temporally Invariant Learned DEtector.",
https://github.com/kmyid/TILDE/tree/v1.0.1

Abhijit Bendale, Terrance Boult
Towards OpenWorld Recognition
http://vast.uccs.edu/OpenWorld

Simone Frintrop, Thomas Werner, and Germán Martín García
Traditional Saliency Reloaded: A Good Old Model in New Shape 
http://www.iai.uni-bonn.de/~frintrop/vocus2-version1.0.tgz

Aravindh Mahendran and Andrea Vedaldi. 
"Understanding deep image representations by inverting them."
https://github.com/aravindhm/deep-goggle

Joan Alabort-i-Medina1, Stefanos Zafeiriou1
Unifying Holistic and Parts-Based Deformable Model Fitting
http://www.menpo.org/

M. Cho, S. Kwak, C. Schmid, J. Ponce
Unsupervised Object Discovery and Localization in the Wild: Part-based Matching with Bottom-up Region Proposals
http://www.di.ens.fr/w…/research/objectdiscovery/UODL_v1.zip

Chenxia Wu et. al. 
Watch-n-Patch: Unsupervised Understanding of Actions and Relations
http://watchnpatch.cs.cornell.edu/

Fatemeh Shokrollahi Yancheshmeh et. al.
Unsupervised Visual Alignment with Similarity Graphs
https://bitbucket.org/kamara…/image_alignment-code/wiki/Home

=========================================================
공개 예정

Yongfang Cheng, Jose A Lopez, Octavia Camps, Mario Sznaier
A Convex Optimization Approach to Robust Fundamental Matrix Estimation
http://robustsystems.coe.neu.edu/?q=content/publications

L. Wang, Y. Qiao, and Xiaoou Tang, 
Action Recognition with Trajectory-Pooled Deep-Convolutional Descriptors,
https://wanglimin.github.io/tdd/index.html

Marcus A. Brubaker, Ali Punjani and David Fleet
"Building Proteins in a Day: Efficient 3D Molecular Reconstruction"
http://www.cs.toronto.edu/~mbrubake/

Ross Girshick Forrest Iandola Trevor Darrell Jitendra Malik
Deformable Part Models are Convolutional Neural Networks
http://www.cs.berkeley.edu/~rbg/

Ching L. Teo, Cornelia Fermüller, Yiannis Aloimonos
Fast 2D Border Ownership Assignment
http://www.umiacs.umd.edu/~cteo/BOWN_SRF/

Saurabh Singh, Derek Hoiem and David Forsyth. 
Learning a Sequential Search for Landmarks 
http://vision.cs.uiuc.edu/projects/lssland/

Paul Wohlhart and Vincent Lepetit
Learning Descriptors for Object Recognition and 3D Pose Estimation
https://cvarlab.icg.tugraz.at/projects/3d_object_detection/

Philippe Weinzaepfel Jerome Revaud Zaid Harchaoui Cordelia Schmid
Learning to Detect Motion Boundaries
http://lear.inrialpes.fr/research/motionboundaries/

Mi Zhang, Jian Yao*, Menghan Xia, Yi Zhang, Kai Li, and Yaping Liu. 
"Line-Based Multiple Label Energy Optimization for Fisheye Image Rectification and Calibration
http://cvrs.whu.edu.cn/projects/FIRC/

Xufeng Han et. at.
MatchNet: Unifying Feature and Metric Learning for Patch-based Matching
http://www.cs.unc.edu/~xufeng/matchnet/

Sean Bell, Paul Upchurch, Noah Snavely, Kavita Bala
Material Recognition in the Wild with the Materials in Context Database
http://opensurfaces.cs.cornell.edu/publications/minc/…

Yu-Wei Chao, Zhan Wang, Rada Mihalcea, and Jia Deng. 
Mining Semantic Affordances of Visual Object Categories
http://www-personal.umich.edu/~ywchao/semantic_affordance/

Moritz Menze and Andreas Geiger
Object Scene Flow for Autonomous Vehicles
http://www.cvlibs.net/projects/objectsceneflow/

Jeong-Kyun Lee and Kuk-Jin Yoon
Real-time Joint Estimation of Camera Orientation and Vanishing Points
https://cvl.gist.ac.kr/…/real-time-joint-estimation-of-came…

Hyung Jin Chang Yiannis Demiris
Unsupervised Learning of Complex Articulated Kinematic Structures combining Motion and Skeleton Information
https://hyungjinchang.wordpress.com/…/kinematic-structure-…/

High Dynamic Range Imaging(HDR)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Reference : http://docs.opencv.org/3.0.0/d3/db7/tutorial_hdr_imaging.html
// Examples : High Dynamic Range Imaging(HDR)
 
#include <cv.hpp>
#include <iostream>
#include <fstream>
 
using namespace std;
using namespace cv;
 
void loadExposureSqe(String path, vector<Mat>& images, vector<float>&times)
{
    path = path + std::string("/");
    ifstream list_file((path + "list.txt").c_str());
 
    string name;
    float val;
 
    while (list_file >> name >> val) {
        Mat img = imread(path + name);
        images.push_back(img);
        times.push_back(1 / val);
    }
 
    list_file.close();
}
 
int main()
{
    vector<Mat> images;
    vector<float> times;
    loadExposureSqe("hdr/exposures", images, times);
 
    Mat response;
    Ptr<CalibrateDebevec>  calibrate = createCalibrateDebevec();
    calibrate->process(images, response, times);
 
    Mat hdr;
    Ptr<MergeDebevec> merge_debevec = createMergeDebevec();
    merge_debevec->process(images, hdr, times, response);
 
    Mat ldr;
    Ptr<TonemapDurand> tonemap = createTonemapDurand(2.2f);
    tonemap->process(hdr, ldr);
 
    Mat fusion;
    Ptr<MergeMertens> merge_mertens = createMergeMertens();
    merge_mertens->process(images, fusion);
 
    imwrite("hdr/fusion.png", fusion * 255);
    imwrite("hdr/ldr.png", ldr * 255);
    imwrite("hdr/hdr.hdr", hdr);
    
    return 0;
}
cs






 

    hdr.zip