The Hamparsum notation system has been used since the17th century and it has been used especially in Ottoman and Armenian music.However, this note system has been replaced by the current musical note system.For this reason, many unique historical artifacts is found in this note systemand are read by people who know this system. In this project, it is aimed thatthis note system which has historical importance is taken and converted into currentnote system. In this way, it is aimed to help the artistic progresses betweenthe old and new note system.
In this project Zybo Z7-20 will be used as system board. The Pcam 5C camera module will also be used to display the notes. The image processing algorithm will be processed wih using Vivado HLS. The output, which is up-to-date musical note system, will be displayed on the monitor via Ethernet or saved to SD Card.
Pcam 5C
Zybo Z7 Pcam-5C Demo was used for connection. MIPI is used for connect Pcam-5C. RGB 24 bit data AXI-Stream Master output created for used in VDMA input.
Image Filter Block and VDMA
image_filter IP Block was created with using Vivado HLS. C++ code was used.
Below code aimed to find contours. Next step is put each contours to rectangles. This helps to separetes notes.
threshold.cpp:
#include "threshold.hpp"
void image_filter(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM){
#pragma HLS INTERFACE axis port=INPUT_STREAM
#pragma HLS INTERFACE axis port=OUTPUT_STREAM
#pragma HLS interface ap_ctrl_none port=return
GRAY_IMAGE thImg(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE thImg2(MAX_HEIGHT, MAX_WIDTH);
RGB_IMAGE img_0(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img_1(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img_2(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img_2a(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img_2b(MAX_HEIGHT, MAX_WIDTH);
GRAY_IMAGE img_2c(MAX_HEIGHT, MAX_WIDTH);
#pragma HLS dataflow
hls::AXIvideo2Mat(INPUT_STREAM, img_0);
hls::CvtColor<HLS_BGR2GRAY>(img_0, img_1);
hls::Threshold(img_1,img_2, 120, 255, HLS_THRESH_BINARY);
hls::Duplicate(img_2,thImg,thImg2);
hls::Dilate(thImg, img_2a);
hls::AbsDiff(img_2a,thImg2,img_2c);
hls::Mat2AXIvideo(img_2c, OUTPUT_STREAM);
}
threshold.hpp:
#include "hls_video.h"
#include <ap_fixed.h>
#define MAX_WIDTH 1280
#define MAX_HEIGHT 720
typedef hls::stream<ap_axiu<24,1,1,1> > AXI_STREAM;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> RGB_IMAGE;
typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> GRAY_IMAGE;
void image_filter(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM);
threshold_tb.cpp:(Test Bench)
#include <hls_opencv.h>
#include "threshold.hpp"
#include <iostream>
using namespace std;
int main (int argc, char** argv) {
IplImage* src;
IplImage* dst;
AXI_STREAM src_axi, dst_axi;
src = cvLoadImage("testNote.bmp");
dst = cvCreateImage(cvGetSize(src), src->depth, src->nChannels);
IplImage2AXIvideo(src, src_axi);
image_filter(src_axi, dst_axi);//src->height,src->width);
AXIvideo2IplImage(dst_axi, dst);
cvSaveImage("notes.bmp", dst);
cvReleaseImage(&src);
cvReleaseImage(&dst);
}
After these, IP block is created with usin "Export RTL" command. In our Vivado design, new IP Block file is added to IP Repository. Required connections are done like:
- VDMA M_AXIS_MM2S port is connected to created HLS IP Block.
- ap_clk is connected to VDMA's aclk.
- ap_rst_n is connected to VDMA's axi_resetn.
Comments