ImageSaveGPU.cpp
2.31 KB
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
#include "ImageSaveGPU.h"
#include "cuda_kernels.h"
#include "logger.hpp"
int resizeFrame(float* d_srcRGB, int src_width, int src_height, float* d_dstRGB, int dst_width, int dst_height)
{
cudaError_t cudaStatus = cuda_common::ResizeImage(d_srcRGB, src_width, src_height, d_dstRGB, dst_width, dst_height);
if (cudaStatus != cudaSuccess) {
LOG_ERROR("cuda_common::ResizeImage failed: {}",cudaGetErrorString(cudaStatus));
return -1;
}
return 0;
}
int drawImageOnGPU(float* d_srcRGB, int src_width, int src_height, int left, int top, int right, int bottom)
{
cuda_common::DrawImage(d_srcRGB, src_width, src_height, left, top, right, bottom);
return 0;
}
int drawImageOnGPU(unsigned char* d_srcRGB, int src_width, int src_height, int left, int top, int right, int bottom)
{
cuda_common::DrawImage(d_srcRGB, src_width, src_height, left, top, right, bottom);
return 0;
}
int drawLineOnGPU(float* d_srcRGB, int src_width, int src_height, int begin_x, int begin_y, int end_x, int end_y)
{
cuda_common::DrawLine(d_srcRGB, src_width, src_height, begin_x, begin_y, end_x, end_y);
return 0;
}
int partMemCopy(unsigned char* d_srcRGB, int src_width, int src_height, unsigned char* d_dstRGB, int left, int top, int right, int bottom)
{
cudaError_t cudaStatus = cuda_common::PartMemCopy(d_srcRGB, src_width, src_height, d_dstRGB, left, top, right, bottom);
if (cudaStatus != cudaSuccess) {
LOG_ERROR("cuda_common::PartMemCopy failed: {} {} {} {} {} {} {}",cudaGetErrorString(cudaStatus), left, top, right, bottom, src_height, d_dstRGB);
return -1;
}
return 0;
}
int PartMemResizeBatch(unsigned char * d_srcRGB, int src_width, int src_height, unsigned char** d_dstRGB,
int count, int* vleft, int * vtop, int* vright, int* vbottom, int *dst_w, int *dst_h,
float submeanb, float submeang, float submeanr,
float varianceb, float varianceg, float variancer)
{
//g_os << "cudaMemcpyHostToDevice begin 9" << std::endl;
cudaError_t cudaStatus = cuda_common::PartMemResizeBatch(
d_srcRGB, src_width, src_height, d_dstRGB, count, vleft, vtop, vright, vbottom, dst_w, dst_h,
submeanb, submeang, submeanr,
varianceb, varianceg, variancer);
//g_os << "cudaMemcpyHostToDevice end 9" << std::endl;
if (cudaStatus != cudaSuccess) {
LOG_ERROR("cuda_common::PartMemResizeBatch failed: {}",cudaGetErrorString(cudaStatus));
return -1;
}
return 0;
}