DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
True Drop Box
FTP/SFTP Hosting
Group Account
Team Anywhere
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Cloud-to-Cloud Backup
|
DVR/Camera Backup
FTP, Email & Web Service
FTP/SFTP Hosting
|
Email Hosting
|
Web Hosting
|
Webcam Hosting
Cloud Surveillance & Remote Desktop
Team Anywhere
|
Access Remote PC
|
Cloud Surveillance
|
Virtual CCTV NVR
Quick Links
Security and Privacy
Customer Support
Service Manual
Use Cases
Group Account
Online Help
Support Forum
Contact Us
About DriveHQ
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
Cloud Surveillance & Remote Desktop
Team Anywhere (Remote Desktop Service)
CameraFTP Cloud Surveillance
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
CameraFTP Software & Apps
DriveHQ Team Anywhere
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
CameraFTP Cloud Recording Service Plans
DriveHQ Team Anywhere Service Plans
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Sign up
Help
Support Home
Support Forum
Service Manual
Online Help
Tutorial videos
Remote Support
About DriveHQ
Contact
CameraFTP Support
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
#include "floatImage.h" #include
#include
#include "bwImage.h" #include "rgbImage.h" floatImage::floatImage( floatImage *src1, floatImage *src2, bool add ) : width_(src1->getWidth()), height_(src1->getHeight()), size_(src1->getSize()), memSize_(size_*sizeof(float)) { if ( (src2->getWidth()!=width_) || (src2->getHeight()!=height_) || (width_==0) || (height_==0) ) return; if ( (data_=(float*)malloc(memSize_))==0 ) return; if ( add ) { for ( int i=size_-1; i>=0; i-- ) { data_[i] = src1->rawData()[i] + src2->rawData()[i]; } } else { float data1, data2; for ( int i=size_-1; i>=0; i-- ) { data1 = src1->rawData()[i]; data2 = src2->rawData()[i]; data_[i] = sqrtf( data1*data1 + data2*data2 ); } } } floatImage::floatImage( floatImage *src1, floatImage *src2, floatImage *src3, bool add ) : width_(src1->getWidth()), height_(src1->getHeight()), size_(src1->getSize()), memSize_(size_*sizeof(float)) { if ( (src2->getWidth()!=width_) || (src2->getHeight()!=height_) || (src3->getWidth()!=width_) || (src3->getHeight()!=height_) || (width_==0) || (height_==0) ) return; if ( (data_=(float*)malloc(memSize_))==0 ) return; if ( add ) { for ( int i=size_-1; i>=0; i-- ) { data_[i] = src1->rawData()[i] + src2->rawData()[i] + src3->rawData()[i]; } } else { float data1, data2, data3; for ( int i=size_-1; i>=0; i-- ) { data1 = src1->rawData()[i]; data2 = src2->rawData()[i]; data3 = src3->rawData()[i]; data_[i] = sqrtf( data1*data1 + data2*data2 + data3*data3 ); } } } float floatImage::maxComponent() { float maxVal = -FLT_MAX; for ( int i=size_-1; i>=0; i-- ) { if ( maxVal
=0; i-- ) { if ( minVal>data_[i] ) minVal=data_[i]; } return minVal; } float floatImage::findMaxComponent( int &x, int &y ) { float maxVal = -FLT_MAX; for ( int i=size_-1; i>=0; i-- ) { if ( maxVal
=y1; y2-- ) { for( x=x2; x>=x1; x-- ) { pixel(x,y2) = intens; } } } inline void floatImage::gradToulouse( int x, int y, float &grdX, float &grdY ) { #define cos45 0.70710678 #define twoRoot2 2.8284271 float gx1, gy1, gx2, gy2; // calculate gradients diagonally gx2 = (pixel(x+1,y+1)-pixel(x-1,y-1))/twoRoot2; gy2 = (pixel(x-1,y+1)-pixel(x+1,y-1))/twoRoot2; // rotate the gradient to x and y axis gx1 = cos45*(gx2 - gy2); gy1 = cos45*(gx2 + gy2); // calculate the gradients vertically and horizontally gx2 = (pixel(x+1,y)-pixel(x-1,y))/2.0f; gy2 = (pixel(x,y+1)-pixel(x,y-1))/2.0f; // average the two gradient claculations grdX = (gx1 + gx2) / 2.0f; grdY = (gy1 + gy2) / 2.0f; // estimate the difference in gradients by the two calculations float len1 = sqrt(gx1*gx1+gy1*gy1); float len2 = sqrt(gx2*gx2+gy2*gy2); // prevent division by 0 if ( (len1<0.000001f) && (len2<0.000001f) ) return; if ( len1>len2 ) { gx1 /= len1; gy1 /= len1; gx2 /= len1; gy2 /= len1; } else { gx1 /= len2; gy1 /= len2; gx2 /= len2; gy2 /= len2; } gx1 -= gx2; gy1 -= gy2; len1 = sqrt(gx1*gx1+gy1*gy1) + 1.0f; // len1 of gr1 is in the range 1 to 3 grdX /= len1; grdY /= len1; } void floatImage::imgGradToulouse( floatImage *&gradImgX, floatImage *&gradImgY ) { gradImgX = new floatImage( width_, height_ ); gradImgY = new floatImage( width_, height_ ); if ( (gradImgX==0) || (gradImgY==0) ) return; for ( int y=0; y
pixel(x,y)=0.0f; gradImgY->pixel(x,y)=0.0f; } else { gradToulouse(x,y,gradImgX->pixel(x,y),gradImgY->pixel(x,y)); } } } } void floatImage::imgGrad( floatImage *&gradImgX, floatImage *&gradImgY ) { gradImgX = new floatImage( width_, height_ ); gradImgY = new floatImage( width_, height_ ); if ( (gradImgX==0) || (gradImgY==0) ) return; for ( int y=0; y
pixel(x,y)=0.0f; gradImgY->pixel(x,y)=0.0f; } else { gradImgX->pixel(x,y) = (pixel(x+1,y)-pixel(x-1,y))/2.0f; gradImgY->pixel(x,y) = (pixel(x,y+1)-pixel(x,y-1))/2.0f; } } } }
floatImage.C
Page URL
File URL
Prev
11/50
Next
Download
( 5 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.