91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 13.3MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-06-29
  • 語言: 其他
  • 標簽: edge??detection??

資源簡介

This program is meant to run a sobel filter using three different methods. Each sobel filter function runs in a different way than the others, one is a basic sobel filter running through just the cpu on a single thread, another runs through openmp to parallelize the single threaded cpu function, and the last one runs through a NVIDIA gpu to parallelize the function onto the many cores available on the gpu. The resulting output from the functions should be the same no matter which way it is ran, the only difference will be the time taken to process each method. In most cases, the CPU will run the slowest, then openmp, and finally the GPU method will run the fastest (due to having more cores to handle many small computations). The result will be an image showing an edge map produced by each method, the edge maps should all be the same.

資源截圖

代碼片段和文件信息

/*************************************************************************************************
?*?File:?imageLoader.cpp
?*?Date:?10/16/2017
?*
?*?Description:?This?file?is?meant?to?be?a?file?of?load/write?functions?for?the?original?program.
?*??????The?file?includes?both?a?useful?typedef?to?shorten?unsigned?chars?into?bytes?and?a?struct
?*??????meant?to?make?accessing?image?data?easier.
?*************************************************************************************************/
#include?“lodepng.h“
#include?

typedef?unsigned?char?byte;?//?most?useful?typedef?ever

/************************************************************************************************
?*?struct?imgData(byte*?uint?uint)
?*?-?a?struct?to?contain?all?information?about?our?image
?***********************************************************************************************/
struct?imgData?{
????imgData(byte*?pix?=?nullptr?unsigned?int?w?=?0?unsigned?int?h?=?0)?:?pixels(pix)?width(w)?height(h)?{
????};
????byte*?pixels;
????unsigned?int?width;
????unsigned?int?height;
};

/************************************************************************************************
?*?imgData?loadImage(char*)
?*?-?takes?in?a?filename?with?a?png?extension?and?uses?LodePNG?to?decode?it?the?resulting?data
?*?-?is?converted?to?grayscale?and?then?a?structure?containing?the?pixel?data?image?width?and
?*?-?height?are?returned?out.?Decoding?currently?uses?a?C?style?decoding?that?uses?free?and?an
?*?-?array?might?consider?re-writing?to?use?the?newer?decode?using?a?C++?vector?if?I?have?time.
?*??
?*?Inputs:?char*?filename?:?the?filename?of?the?image?to?load
?*?Outputs:???????imgData?:?a?structure?returned?containing?the?image?data?(pixels?width?height)
?*?
?***********************************************************************************************/
imgData?loadImage(char*?filename)?{
????unsigned?int?width?height;
????byte*?rgb;
????unsigned?error?=?lodepng_decode_file(&rgb?&width?&height?filename?LCT_RGBA?8);
????if(error)?{
????????printf(“LodePNG?had?an?error?during?file?processing.?Exiting?program.\n“);
????????printf(“Error?code:?%u:?%s\n“?error?lodepng_error_text(error));
????????exit(2);
????}
????byte*?grayscale?=?new?byte[width*height];
????byte*?img?=?rgb;
????for(int?i?=?0;?i?????????int?r?=?*img++;
????????int?g?=?*img++;
????????int?b?=?*img++;
????????int?a?=?*img++;
????????grayscale[i]?=?0.3*r?+?0.6*g?+?0.1*b+0.5;
????}
????free(rgb);
????return?imgData(grayscale?width?height);
}

/************************************************************************************************
?*?void?writeImage(char*?std::string?imgData)
?*?-?This?function?takes?a?filename?as?a?char?array?a?string?of?text?and?a?structure?containing
?*?-?the?image‘s?pixel?info?width?and?height.?The?function?will?take?the?original?filename
?*?-?remove?the?.png?ending?and?append?text?before?re-adding?the?.png?extension?then?lodepng?is
?*?-?ca

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-10-18?15:44??CUDA-Sobel-Filter-master\
?????文件??????????50??2017-10-18?15:44??CUDA-Sobel-Filter-master\.gitignore
?????文件?????????469??2017-10-18?15:44??CUDA-Sobel-Filter-master\Makefile
?????文件????????1206??2017-10-18?15:44??CUDA-Sobel-Filter-master\README.md
?????文件????13861916??2017-10-18?15:44??CUDA-Sobel-Filter-master\flags.png
?????文件????????4037??2017-10-18?15:44??CUDA-Sobel-Filter-master\imageLoader.cpp
?????文件??????220491??2017-10-18?15:44??CUDA-Sobel-Filter-master\lodepng.cpp
?????文件???????82320??2017-10-18?15:44??CUDA-Sobel-Filter-master\lodepng.h
?????文件???????12768??2017-10-18?15:44??CUDA-Sobel-Filter-master\sobelFilter.cu

評論

共有 條評論