From 5464c22a339a40d215176228666120550cf5e091 Mon Sep 17 00:00:00 2001 From: Vindicator645 <45960487+Vindicator645@users.noreply.github.com> Date: Fri, 28 Dec 2018 23:09:59 +0800 Subject: [PATCH] Added some of the algorithm --- Unused/FFT/FFT.cpp | 4 ++-- document/算法部分.md | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Unused/FFT/FFT.cpp b/Unused/FFT/FFT.cpp index 7b75a08..5db2d3e 100644 --- a/Unused/FFT/FFT.cpp +++ b/Unused/FFT/FFT.cpp @@ -66,7 +66,7 @@ int main() { std::cout << R << " " << G << " " << B; std::cout << "\n"<< R << " " << G << " " << B; } -double Get_RGB::hztospectrun(double hz) { +double Get_RGB::hztospectrum(double hz) { double hbox; hbox = hz; for (;hbox > 800;hbox = hbox / 2); @@ -85,4 +85,4 @@ void Get_RGB::spectral_color(double &r, double &g, double &b, double l) // RGB else if ((l >= 585.0) && (l < 639.0)) { t = (l - 585.0) / (639.0 - 585.0); g = 0.84 - (0.84*t); } if ((l >= 400.0) && (l < 475.0)) { t = (l - 400.0) / (475.0 - 400.0); b = +(2.20*t) - (1.50*t*t); } else if ((l >= 475.0) && (l < 560.0)) { t = (l - 475.0) / (560.0 - 475.0); b = 0.7 - (t)+(0.30*t*t); } -} \ No newline at end of file +} diff --git a/document/算法部分.md b/document/算法部分.md index 4112f2e..3b4d083 100644 --- a/document/算法部分.md +++ b/document/算法部分.md @@ -1,2 +1,12 @@ -# +##¶Ôº¯ÊýDataÀàµÄ·ÖÎö +1.º¯ÊýData2color¸ù¾Ý×óÉùµÀµÄÒôÁ¿±ä»¯ÂÊ£¬¾ö¶¨Êä³öÑÕÉ«RµÄÖµ£»¸ù¾ÝÓÒÉùµÀµÄ±ä»¯ÂÊ£¬¾ö¶¨Êä³öÑÕÉ«BµÄÖµ£»¸ù¾ÝÉùÒôµÄÒôÁ¿£¬¾ö¶¨Êä³öÑÕÉ«GµÄÖµ¡££¨½ÔΪ±ä»¯ÂÊÔ½´ó£¬ÑÕÉ«ÖµÔ½´ó£©ÖÐ;»áµ÷ÓÃHSVÄڵĺ¯Êý£¬¶ÔÉ«²Ê½øÐÐÔöÒæ¡£ +##¶ÔHSV.hppÄÚº¯ÊýµÄ·ÖÎö +1.´ËÀàÓÃÓÚʵÏÖRGBÓëHSVµÄÏ໥ת»¯£¬ÒÔ±ãÄÜͨ¹ý¸Ä±äS£¨±¥ºÍ¶È£©À´µ÷½Ú»­ÃæµÄÏÊÑ޳̶ȡ£ +2.º¯Êýhsv2rgbÓÃÀ´½«hsvֵת»¯»Ørgb¡£ +3.º¯Êýrgb2hsvÓÃÀ´½«rgbת»¯µ½hsv¡£ +##¶ÔGet_RGBÀàµÄ·ÖÎö +1.º¯Êýfftw3ÓÃÓÚ½«¸ø¶¨Çø¼äÄÚµÄÒôÁ¿Ê±ÓòÐźţ¨ÓÉ¡°Êý¾Ý²¿·Ö¡±¶ÁÈëÔÚÈô¸Émsʱ¼äÄÚÿһʱ¿ÌµÄÒôÁ¿Ïì¶È£©Í¨¹ýµ÷ÓÃfftw3ÄÚµÄFFTW_MEASURE(µ÷ÊԽ׶ÎʹÓÃFFTW_ESTIMATE)·Ö½âΪƵÓòÐźţ¬´Ó0µ½FRµÄƵÂÊÿһ¸öƵÂʶ¼¶ÔÓ¦Ò»¸ö¸´Êý£¬È¡Õâ¸ö¸´ÊýµÄÄ£³¤Îª¸ÃƵÂʵÄÕñ·ù£¨¼ÙÉè²ÉÑùƵÂÊΪ FR , ²ÉÑùµãÊýΪ1024 (NN),ÄÇôºá×ø±êµÚN¸öµã´ú±íµÄƵÂÊ X(N) = (FR / NN) * N£©¡£½«ÕâЩƵÂÊÖµ´«µÝ¸øhzTospectrum¡£ +2.º¯ÊýhztospectrumÓÃÓÚ½«ÉùÒôƵÂÊÐźÅת»¯Îª¹âµÄƵÂÊÐźţ¬´«µÝ¸øspectral_color¡£·½·¨ÊÇÿ´ÎÔö¼Ó»ò¼õÉÙÒ»¸ö°Ë¶È£¨Ôö¼ÓÒ»¸ö°Ë¶ÈΪƵÂÊÖµ³ËÒÔ2£¬¼õÉÙÒ»¸ö°Ë¶ÈΪƵÂÊÖµ³ýÒÔ2.£©¸Ã¼ÆËã·½·¨À´Ô´ÓÚhttp://www.flutopedia.com/sound_color.html +3.º¯Êýspectral_colorÓÃÓÚ½«Ã¿Ò»¸ö¹âµÄƵÂÊֵת»¯ÎªRGBÖµ¡£¹«Ê½À´Ô´ÓÚhttps://stackoverflow.com/questions/3407942/rgb-values-of-visible-spectrum +4.´ËÀàËäÈ»¸üÓпÆѧÒÀ¾Ý£¬¿ÉÄܸüΪ×ÔÈ»£¬Ìù½üÏÖʵ£¬µ«ÓÉÓÚ¹¤³ÌÉϹýÓÚ¸´ÔÓ£¬ÉÐδµ÷ÊÔÍê³É£¬¼ÓÉ϶ÔÔ¤ÆÚ½á¹ûµÄ´æÒÉ£¬Òò´ËÔÝʱ¸éÖÃʹÓ㬽«À´¿ÉÄÜ¿ÉÒÔ³ÉΪÄÜÔÚÓû§½çÃæ½øÐÐÑ¡ÔñʹÓõÄÒ»¸öËã·¨¡£