c++ 2d convolution, Add matrices to code

Add these two matrices to the code to generate output matrix result

input = {1,2,3,4,5,6,7,8,9,10,11,12,15,16};

Sharpen_Kernal ={0,-1,0,-1,5,-1,0,-1,0};


#include <cmath>

#include "convolution.h"​

bool convolve2DSlow(unsigned char* in, unsigned char* out, int dataSizeX, int dataSizeY,

float* kernel, int kernelSizeX, int kernelSizeY)


int i, j, m, n, mm, nn;

int kCenterX, kCenterY; // center index of kernel

float sum; // temp accumulation buffer

int rowIndex, colIndex;

// check validity of params

if(!in || !out || !kernel) return false;

if(dataSizeX <= 0 || kernelSizeX <= 0) return false;

// find center position of kernel (half of kernel size)

kCenterX = kernelSizeX / 2;

kCenterY = kernelSizeY / 2;

for(i=0; i < dataSizeY; ++i) // rows


for(j=0; j < dataSizeX; ++j) // columns


sum = 0; // init to 0 before sum

for(m=0; m < kernelSizeY; ++m) // kernel rows


mm = kernelSizeY - 1 - m; // row index of flipped kernel

for(n=0; n < kernelSizeX; ++n) // kernel columns


nn = kernelSizeX - 1 - n; // column index of flipped kernel

// index of input signal, used for checking boundary

rowIndex = i + (kCenterY - mm);

colIndex = j + (kCenterX - nn);

// ignore input samples which are out of bound

if(rowIndex >= 0 && rowIndex < dataSizeY && colIndex >= 0 && colIndex < dataSizeX)

sum += in[dataSizeX * rowIndex + colIndex] * kernel[kernelSizeX * mm + nn];



out[dataSizeX * i + j] = (unsigned char)((float)fabs(sum) + 0.5f);



return true;


****************************** convlution.h ************************



bool convolve2DSlow(unsigned char* in, unsigned char* out, int sizeX, int sizeY, float* kernel, int kSizeX, int kSizeY);​


Taidot: Algoritmi, C-ohjelmointi, C# -ohjelmointi, C++ -ohjelmointi, tietojärjestelmäarkkitehtuuri

Näytä lisää: aspnet updatepanel add trigger code, sample code generate fake data, vba code generate report excel, convolution in c, convolving 2 matrices, convolution with gaussian matrix c, 2d convolution python, convolution of two images, 2d convolution c++, how to calculate convolution of two matrices, image convolution c++, send add friends code myspace, possible add promotion code paypal, protx add basket code, add keywords code website, add tracking code, add coupon code pay pal, add promo code paypal, examples add tracking code website, add product code php

Tietoa työnantajasta:
( 4 arvostelua ) Rochester, United States

Projektin tunnus: #18260463

Myönnetty käyttäjälle:


Hello. I'm an 10 years experienced C/C++ programmer. I've already completed many algorithm related project. And I've experienced convolution while accelerating gemm library ( yolo ) I think my skill can be help for Lisää

$30 USD 1 päivässä
(14 Arvostelua)

4 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


Hi there, I can help you out with the task. Please ping me so we may discuss it in detail. Thanks, Adeel

$25 USD 1 päivässä
(7 arvostelua)

Hi bro. I have read your description and I am so interested in your project. I am confident in your project and I can finish it clearly on time. I am well experienced and skillful C and C++ programmer. I have +15 Lisää

$25 USD 1 päivässä
(5 arvostelua)

Hello, I can help you out with the 2d convolution code. Can you please share more details about it? Thanks, Shoaib

$35 USD 1 päivässä
(3 arvostelua)