⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fvsimage.cpp

📁 本系统是一个指纹识别系统,可以用来识别用户的指纹,可以用在安全性高的行业或部门.
💻 CPP
字号:
// This file contains the implementation for FvsImage class#ifndef __FVSIMAGE_IMPLEMENTATION__#define __FVSIMAGE_IMPLEMENTATION__#include <stdlib.h>#include "fvsimage.h"#include "vector.h"// default constuctor creates a data matrix of 0x0template <class itemType>FvsImage<itemType>::FvsImage(void){	FvsImage<itemType>::cols = 0;	FvsImage<itemType>::rows = 0;	FvsImage<itemType>::data = 0;}// constructor that makes data matrix a specfic width and heighttemplate <class itemType>FvsImage<itemType>::FvsImage(uint32_t width, uint32_t height){	uint32_t i;	// Change variables	FvsImage<itemType>::rows = height;	FvsImage<itemType>::cols = width;	FvsImage<itemType>::data.resize(width);	// resize each vector 	for (i = 0; i < width; i++)	{		FvsImage<itemType>::data[i].resize(height);	}}// constructor that makes matrix a spefic width and height and fills// entire matrix with specific valuetemplate <class itemType>FvsImage<itemType>::FvsImage(uint32_t width, uint32_t height, itemType fillValue){	uint32_t i, j;	// changes variables	FvsImage<itemType>::rows = height;	FvsImage<itemType>::cols = width;	FvsImage<itemType>::data.resize(width);	// loop throught, resize and fill matrix	for (i = 0; i < width; i++)	{		FvsImage<itemType>::data[i].resize(height);		for (j = 0; j < width; j++)		{			FvsImage<itemType>::data[i][j] = fillValue;		} // for j	} // for i}// copy contructortemplate <class itemType>FvsImage<itemType>::FvsImage(const FvsImage<itemType> & src){	uint32_t i, j;	// Change variables 	FvsImage<itemType>::rows = src.rows;	FvsImage<itemType>::cols = src.cols;	FvsImage<itemType>::data.resize(src.cols);	// loop through and copy matrix	for (i = 0; i < src.cols; i++)	{		// resize current row 		FvsImage<itemType>::data[i].resize(src.rows);		for (j = 0; j < src.rows; j++)		{			FvsImage<itemType>::data[i][j] = src.data[i][j];		} // for j	} // for i}// destructor, don't need to do anything vector destructor will take care// of freeing up memory. This is here for expandablity. template <class itemType>FvsImage<itemType>::~FvsImage(void){}// indexing with range checking// this is used to retrieve imformation (heance the consts)template <class itemType>const Vector<itemType> & FvsImage<itemType>::operator [] (uint32_t k) const{	// make sure we aren't out of bounds	if (k < 0 || k > cols)	{		printf("Out of bounds\n");		exit(1);		// **********************Error code here*************************	} else {		return data[k];	}}// this allows for assignmenttemplate <class itemType>Vector<itemType> & FvsImage<itemType>::operator [] (uint32_t k) {	// make sure we are not out of bounds	if (k < 0 || k > cols)	{		printf("Out of bounds\n");		exit(1);		// **********************Error code here*************************		} else {		return data[k];	}}// assignment operatortemplate <class itemType>const FvsImage<itemType> & FvsImage<itemType>::operator = (const FvsImage<itemType> & src){	uint32_t i;	// don't assign to self	if (this != & src)	{		data.resize(src.cols); 		rows = src.rows;		cols = src.cols;		for (i = 0; i < src.rows; i++)		{			data[i] = src.data[i];		}	}	return *this; // returns copy not address reference}// resizes data member (resize vectors)template <class itemType>void FvsImage<itemType>::resize(uint32_t NewWidth, uint32_t NewHeight){	uint32_t k;	data.resize(NewWidth);	// loop through and resize each vector 	for (k = 0; k < NewWidth; k++)	{		data[k].resize(NewHeight);	}	cols = NewWidth;	rows = NewHeight;}// returns width (cols) of current data matrix template <class itemType>uint32_t FvsImage<itemType>::width() const{	return cols;}// returns height (rows) of current data matrixtemplate <class itemType>uint32_t FvsImage<itemType>::height() const{	return rows;}#endif __FVSIMAGE_IMPLEMENTATION__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -