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

📄 ltkimagewriter.h

📁 An open source handwriting recongnition package!!!
💻 H
📖 第 1 页 / 共 2 页
字号:
 // 	int drawRawInkFileToImage(const string& fileName,const string& imgFileName,int size);
	void drawRawInkFileToImage(const string fileName,const string imgFileName,int size);



	/**
	 * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
	 *
	 * @param unipenFileName path to the unipen data file
	 * @param imgFileName name of the file that is to be created to draw the image
	 * @param imgWidth width of the image
	 * @param imgHeight height of the image
	 *
	 * @return void

	 */

//	int drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName,int imgWidth,int imgHeight);
	void drawUnipenFileToImage(const string unipenFileName,const string imgFileName,int imgWidth,int imgHeight);



	/**
	 * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The width and height would be determined from the trace group.
	 *
	 * @param unipenFileName path to the unipen data file
	 * @param imgFileName name of the file that is to be created to draw the image
	 *
	 * @return void
	 */
//	int drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName);
	void drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName);



	/**
	 * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
	 *
	 * @param unipenFileName path to the unipen data file
	 * @param imgFileName name of the file that is to be created to draw the image
	 * @param size bound on larger dimension
	 *
	 * @return void
	 */
//	int drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName,int size);
	void drawUnipenFileToImage(const string& unipenFileName,const string& imgFileName,int size);



	/**
	 * The function creates LTKTraceGroup from the specified unipen data file and draws it to image file with specified color and offset. The size specified is the bound on larger dimension and the trace group is normalized to maintain the aspect ratio.
	 * The bounding box of the image is also drawn to show relative position.
	 *
	 * @param unipenFileName path to the unipen data file
	 * @param imgFileName name of the file that is to be created to draw the image
	 * @param size bound on larger dimension
	 *
	 * @return void
	 */


  //int drawUnipenFileToImageWithBB(const string& unipenFileName,const string& imgFileName,int size);  
	void drawUnipenFileToImageWithBB(const string& unipenFileName,const string& imgFileName,int size);


	/**
	 * Setter method for showing the starting point of each stroke
	 *
	 * @param toShow flag to show the starting point
	 *
	 * @return
	 */

   	void showStartingPoint(bool toShow);

	/**
	 * Setter method for color of the starting stroke and subsequent alternate strokes
	 *
	 * @param red value of Red in RGB combination
	 * @param green value of Green in RGB combination
	 * @param blue value of Blue in RGB combination
	 *
	 * @return void
	 */

//int setColor(unsigned char red,unsigned char green,unsigned char blue);    
	void setColor(unsigned char red,unsigned char green,unsigned char blue);

	/**
	 * Setter method for color of alternate strokes
	 *
	 * @param altRed value of Red in RGB combination
	 * @param altGreen value of Green in RGB combination
	 * @param altBlue value of Blue in RGB combination
	 *
	 * @return void
	 */

    //int setAlternateColor(unsigned char altRed,unsigned char altGreen,unsigned char altBlue);
	void setAlternateColor(unsigned char altRed,unsigned char altGreen,unsigned char altBlue);


	/**
	 * Setter method for offset value between strokes
	 *
	 * @param offset value of offset
	 *
	 * @return void
	 */

//	int setOffset(int offset);    
	void setOffset(int offset);


private:

	/**
	 * @name Preprocessing, trace group ordering, and point,line and rectangle drawing functions.
	 */
	// @{

	
	
	/**
	 * The function finds the minimum x value of the given trace.
	 *
	 * @param trace input trace
	 *
	 * @return minimum value of x
	 */

    int findMinXOfTrace(const LTKTrace& trace,float& minX);
	//float findMinXOfTrace(LTKTrace& trace);



	/**
	 * The function finds the maximum x value of the given trace.
	 *
	 * @param trace input trace
	 *
	 * @return maximum value of x
	 */

    int findMaxXOfTrace(const LTKTrace& trace,float& maxX);
	//float findMaxXOfTrace(const LTKTrace& trace);



	/**
	 * The function makes entries in the pixels array for the specified x,y and color.
	 *
	 * @param x,y coordinates of the point to be drawn
	 * @param red,green,blue RGB values of the color of the point
	 *
	 * @return
	 */

    //int drawPoint(int x,int y,unsigned char red,unsigned char green,unsigned char blue);
	void drawPoint(int x,int y,unsigned char red,unsigned char green,unsigned char blue);



	/**
	 * The function draws line between the specified end points.
	 *
	 * @param x1,y1,x2,y2 coordinates of the end points of the line to be drawn
	 * @param red,green,blue RGB values of the color of the line
	 *
	 * @return
	 */

    //int drawLine(int x1, int y1, int x2, int y2,unsigned char red,unsigned char green,unsigned char blue);
	void drawLine(int x1, int y1, int x2, int y2,unsigned char red,unsigned char green,unsigned char blue);



	/**
	 * The function draws hollow rectange with specified color and diagonal end points.
	 *
	 * @param x1,y1,x2,y2 coordinates of the end points of the diagonal of the rectangle
	 * @param red,green,blue RGB values of the color of the lines
	 *
	 * @return
	 */

   	//int drawRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue);
	void drawRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue);



	/**
	 * The function draws a rectange with specified diagonal end points and fills it with the specified color.
	 *
	 * @param x1,y1,x2,y2 coordinates of the end points of the diagonal of the rectangle
	 * @param red,green,blue RGB values of the color of the lines
	 *
	 * @return
	 */

    //int fillRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue);
	void fillRectangle(int x1,int y1,int x2,int y2,unsigned char red,unsigned char green,unsigned char blue);



	/**
	 * The function offsets the input trace group by specified offset value and in the original trace order.
	 *
	 * @param traceGroup input trace group
	 * @param offsetTraceGroup trace group with offset
	 *
	 * @return
	 */

    //int  orderTracesHorizontally(const LTKTraceGroup& traceGroup,LTKTraceGroup& offsetTraceGroup);
	void  createTraceOrderInTraceGroup(const LTKTraceGroup& traceGroup,LTKTraceGroup& offsetTraceGroup);

	/**
	 * The function writes the given pixel array to the specified BMP file
	 *
	 * @param fileName name of output bmp file name with extension as 'bmp'
	 * @param pixelArray pixel array
	 * @param width width of the image
	 * @param height height of the image
	 *
	 * @return
	 */

    // TODO: try replacing the pointer    
 	//int drawBMPImage(const string& fileName,unsigned char* pixelArray,int width,int height);
	void drawBMPImage(string fileName,unsigned char* pixelArray,int width,int height);


};
#endif



⌨️ 快捷键说明

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