本文整理汇总了C++中Pixel::get_pixel方法的典型用法代码示例。如果您正苦于以下问题:C++ Pixel::get_pixel方法的具体用法?C++ Pixel::get_pixel怎么用?C++ Pixel::get_pixel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pixel
的用法示例。
在下文中一共展示了Pixel::get_pixel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: range_error
/**
* Mathematical operation /
* if the size of the left hand side object is 0 the right hand side
* else the size of both pixels has to be the same
*/
Pixel<T> operator/=(const Pixel<T> &rhs) {
if(size_ == rhs.size()) {
for(unsigned char i = 0; i < size_; ++i) {
pixel_[i] /= rhs.get_pixel(i);
validate_value(pixel_[i]);
}
return *this;
} else if(size_ == 0) {
size_ = rhs.size();
delete[] pixel_;
T *temp = new T[size_];
for(unsigned char i = 0; i < size_; ++i) {
temp[i] = rhs.get_pixel(i);
}
pixel_ = temp;;
return *this;
}
std::ostringstream ss;
ss << "A Division between pixels can only happen when they have the same "
<< "size!\t LHS: " << size_ << "\tRHS: "<< rhs.size() << '\n';
throw std::range_error(ss.str());
}
示例2: Pixel
/**
* Copy Constructor
*/
Pixel(const Pixel<T> ©) {
size_ = copy.size();
pixel_ = new T[size_]();
for(int i = 0; i < size_; ++i) {
pixel_[i] = copy.get_pixel(i);
}
}
示例3:
bool operator==(const Pixel<T> &rhs) const {
if(size == rhs.size()) {
for(unsigned char i = 0; i < size_; ++i) {
if(pixel_[i] != rhs.get_pixel(i)) {
return false;
}
}
return true;
}
return false;
}
示例4: round
// rounds the subpixels of the image matrix
void DCT::round(Matrix<Pixel<double> > &mat) {
Pixel<double> pixel;
double buffer;
for(unsigned int i = 0; i < mat.get_row_length(); ++i) {
for(unsigned int j = 0; j < mat.get_col_length(); ++j) {
pixel = mat.get_data(i, j);
for(unsigned int k = 0; k < pixel.size(); ++k) {
buffer = pixel.get_pixel(k);
if(buffer > 0) {
buffer = buffer + 0.5;
} else {
buffer = buffer - 0.5;
}
pixel.set_pixel(k, (int)buffer);
}
mat.set_data(i, j, pixel);
}
}
}