Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://drive.google.com/drive/folders/1D190XNu7W02Dgc8FCwpEeI-2-WKgu4KY?usp=sharing
- https://drive.google.com/drive/folders/1D190XNu7W02Dgc8FCwpEeI-2-WKgu4KY?usp=sharing
- /*
- ------------------------------------------------------------
- ANSI C IMAGE PROCESSING TEMPLATE USING DIP LIBRARY
- by D.K. Iakovidis
- ------------------------------------------------------------
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include "dip.h"
- unsigned char **processImage(unsigned char **inputImage,unsigned char **inputImage2, int rows, int columns);
- int main(void)
- {
- unsigned char *inputFilename1 = "mri221x279.raw",
- *inputFilename2 = "petGrey221x279.raw",
- *outputFilename = "result_img.raw";
- int rows = 221,
- columns = 279;
- unsigned char **inputImage1, **outputImage,**inputImage2;
- inputImage1 = allocateImage(rows, columns);
- inputImage2 = allocateImage(rows, columns);
- inputImage1 = loadImage(inputFilename1, rows, columns);
- inputImage2 = loadImage(inputFilename2, rows, columns);
- outputImage = processImage(inputImage1,inputImage2, rows, columns);
- saveImage(outputFilename, outputImage, rows, columns);
- deallocateImage(inputImage1, rows);
- deallocateImage(inputImage2, rows);
- deallocateImage(outputImage, rows);
- return 0;
- }
- unsigned char **processImage(unsigned char **inputImage1,unsigned char **inputImage2, int rows, int columns)
- {
- int i,j;
- float mesh_timh;
- unsigned char **outputImage = allocateImage(rows, columns);
- for (i = 0; i < rows; i++)
- {
- for (j = 0; j < columns; j++)
- {
- mesh_timh=(inputImage1[i][j]+inputImage2[i][j])/2;
- if(mesh_timh>255){
- mesh_timh=255;}
- if(mesh_timh<0){
- mesh_timh=0}
- }
- outputImage[i][j] = (unsigned char)mesh_timh;
- }
- }
- return outputImage;
- }
- ___________________________________________________________
- /*
- ------------------------------------------------------------
- ANSI C IMAGE PROCESSING TEMPLATE USING DIP LIBRARY
- by D.K. Iakovidis
- ------------------------------------------------------------
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include "dip.h"
- unsigned char **processImage(unsigned char **inputImage, int rows, int columns);
- int main(void)
- {
- unsigned char *inputFilename = "chest339x339.raw",
- *outputFilename = "chest339x339.raw";
- int rows = 339,
- columns = 339;
- unsigned char **inputImage, **outputImage;
- inputImage = allocateImage(rows, columns);
- inputImage = loadImage(inputFilename, rows, columns);
- outputImage = processImage(inputImage, rows, columns);
- saveImage(outputFilename, outputImage, rows, columns);
- deallocateImage(inputImage, rows);
- deallocateImage(outputImage, rows);
- return 0;
- }
- unsigned char **processImage(unsigned char **inputImage, int rows, int columns)
- {
- int i,j;
- unsigned char **outputImage = allocateImage(rows, columns);
- for (i = 0; i < rows; i++)
- {
- for (j = 0; j < columns; j++)
- {
- if(j<columns/2){
- outputImage[i][j] = 255;
- }else{
- outputImage[i][j] = 0;
- }
- if(inputImage[i][j]>170){
- inputImage[i][j] = 255;
- }else{
- inputImage[i][j] = 0;
- }
- outputImage[i][j] =outputImage[i][j]&(255-inputImage[i][j]); // h 3d eikona me xor ^ vgainei h st
- }
- }
- return outputImage;
- }
Add Comment
Please, Sign In to add comment