aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/gra/Bitmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'meowpp/gra/Bitmap.h')
-rw-r--r--meowpp/gra/Bitmap.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/meowpp/gra/Bitmap.h b/meowpp/gra/Bitmap.h
index 59136c2..1457df8 100644
--- a/meowpp/gra/Bitmap.h
+++ b/meowpp/gra/Bitmap.h
@@ -14,6 +14,8 @@
namespace meow {
+const unsigned int kBitmapReadWritePixels = 0x1;
+
/*!
* @brief 二維點陣資料
*
@@ -36,7 +38,7 @@ private:
factor[width] = 1.0;
return factor;
}
-
+
//! 回傳gradiance的權重
static std::vector<double> gradianceFactor1(double sigma) {
double sigma2 = squ(sigma), ss = sigma * 2;
@@ -49,7 +51,7 @@ private:
factor[width] = 0.0;
return factor;
}
-
+
//! 針對某一方向用某種權重模糊
Bitmap xyBlur(std::vector<double> const& factor,
ssize_t dx, ssize_t dy) const {
@@ -100,7 +102,7 @@ public:
/*!
* @brief destructor
*/
- ~Bitmap(){
+ ~Bitmap() {
}
/*!
@@ -237,7 +239,7 @@ public:
/*!
* @brief 回傳矩陣形式
*/
- Matrix<Pixel> const& matrix() const {
+ Matrix<Pixel> matrix() const {
return matrix_;
}
@@ -251,7 +253,7 @@ public:
/*!
* @brief 直接設定
*/
- Matrix<Pixel> const& matrix(Matrix<Pixel> const& p) {
+ Matrix<Pixel> matrix(Matrix<Pixel> const& p) {
matrix_.copyFrom(p);
return matrix();
}
@@ -275,9 +277,8 @@ public:
* @param [in] radiusX 高斯模糊的X軸方向的sigma
* @return *this
*/
- Bitmap<Pixel>& gaussianed(double radiusY, double radiusX) {
- copyFrom(gaussian(radiusY, radiusX));
- return *this;
+ Bitmap& gaussianed(double radiusY, double radiusX) {
+ return copyFrom(gaussian(radiusY, radiusX));
}
/*!
@@ -287,7 +288,7 @@ public:
* @param [in] radiusX 高斯模糊的X軸方向的sigma
* @return 一個\c Bitmap , 是自己被偏微分後的結果
*/
- Bitmap<Pixel> gradianceX(double radiusY, double radiusX) const {
+ Bitmap gradianceX(double radiusY, double radiusX) const {
return (xyBlur(gaussianFactor1(radiusY), 1, 0).
xyBlur(gradianceFactor1(radiusX), 0, 1));
}
@@ -352,7 +353,7 @@ public:
* @note 未完成, 輸入參數 fg 無用
*/
bool write(FILE* f, bool bin, unsigned int fg) const {
- if (fg & 1)
+ if (fg & kBitmapReadWritePixels)
return false;
if (bin) {
long tmp;
@@ -371,7 +372,7 @@ public:
* @note 未完成, 輸入參數 fg 無用
*/
bool read(FILE* f, bool bin, unsigned int fg) {
- if (fg & 1)
+ if (fg & kBitmapReadWritePixels)
return false;
long tmp1, tmp2;
if (bin) {
@@ -423,6 +424,7 @@ public:
}
};
+
} // meow
#endif // gra_Bitmap_H__