圖庫大改動(音效版存在BUG)

This commit is contained in:
jasonchenwork 2025-05-09 17:51:04 +08:00
parent d599d448a7
commit 83fd1da96b
82 changed files with 33 additions and 143 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ build.bat
*.exe
bin/logfile.txt
bin/secondary_graph.grf
bin/mainlog.txt

View File

@ -100,7 +100,7 @@ namespace DualScreenDemo
if (!pictureBoxSceneSoundEffects.Visible)
{
ShowImageOnPictureBoxSceneSoundEffects(Path.Combine(Application.StartupPath, @"themes\superstar\555022.jpg"));
ShowImageOnPictureBoxSceneSoundEffects(Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效.png"));
SetPictureBoxSceneSoundEffectsAndButtonsVisibility(true);
}
else
@ -138,10 +138,10 @@ namespace DualScreenDemo
mediaPlayer.URL = Path.Combine(Application.StartupPath,"sounds" ,"zs.m4a");
mediaPlayer.controls.play();
}
// 按鈕位置需要更改,底圖需要更改
private void ShowImageOnPictureBoxSceneSoundEffects(string imagePath)
{
/*
Bitmap originalImage = new Bitmap(imagePath);
@ -157,6 +157,24 @@ namespace DualScreenDemo
ResizeAndPositionPictureBox(pictureBoxSceneSoundEffects, cropArea.X, cropArea.Y, cropArea.Width, cropArea.Height);
pictureBoxSceneSoundEffects.Visible = true;
*/
if (File.Exists(imagePath))
{
// 直接載入完整圖
Bitmap image = new Bitmap(imagePath);
// 顯示在 PictureBox 上
pictureBoxSceneSoundEffects.Image = image;
// 設定 PictureBox 的大小與位置(依你的需要調整)
ResizeAndPositionPictureBox(pictureBoxSceneSoundEffects, 773, 380, image.Width , image.Height);
pictureBoxSceneSoundEffects.Visible = true;
}
else
{
Console.WriteLine("圖片檔案不存在:" + imagePath);
}
}
private void TogglePictureBoxSceneSoundEffectsButtonsVisibility()

View File

@ -1706,6 +1706,9 @@ public class MultiPagePanel : Panel
}
}
private List<SongData> currentSongList = new List<SongData>();
public List<SongData> get_currentSongList(){
return currentSongList;
}
private List<Artist> currentArtistList = new List<Artist>();
private int _totalPages = 0;
private Point mouseDownLocation; // 新增字段
@ -1839,7 +1842,7 @@ public class MultiPagePanel : Panel
public void LoadSingers(List<Artist> artists)
{
currentArtistList = artists;
currentSongList.Clear();
//currentSongList.Clear();
currentPageIndex = 0;
totalPages = (int)Math.Ceiling(artists.Count / (double)itemsPerPage);
RefreshDisplayBase_Singer();
@ -2667,27 +2670,27 @@ public class MultiPagePanel : Panel
resizedMouseDownImageForNewSongAlert = ResizeImage(mouseDownImageNewSongAlert, targetWidth, targetHeight);
normalStateImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\3.歌星查詢_未按.jpg"));
normalStateImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\歌星查詢_未按.jpg"));
resizedNormalStateImageForArtistQuery = ResizeImage(normalStateImageArtistQuery, targetWidth, targetHeight);
mouseOverImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\3.歌星查詢_已按.jpg"));
mouseOverImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\歌星查詢_已按.jpg"));
resizedMouseOverImageForArtistQuery = ResizeImage(mouseOverImageArtistQuery, targetWidth, targetHeight);
mouseDownImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\3.歌星查詢_已按.jpg"));
mouseDownImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\歌星查詢_已按.jpg"));
resizedMouseDownImageForArtistQuery = ResizeImage(mouseDownImageArtistQuery, targetWidth, targetHeight);
normalStateImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\4.歌名查詢_未按.jpg"));
normalStateImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\歌名查詢_未按.jpg"));
resizedNormalStateImageForSongQuery = ResizeImage(normalStateImageSongQuery, targetWidth, targetHeight);
mouseOverImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\4.歌名查詢_已按.jpg"));
mouseOverImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\歌名查詢_已按.jpg"));
resizedMouseOverImageForSongQuery = ResizeImage(mouseOverImageSongQuery, targetWidth, targetHeight);
mouseDownImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\4.歌名查詢_已按.jpg"));
mouseDownImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\歌名查詢_已按.jpg"));
resizedMouseDownImageForSongQuery = ResizeImage(mouseDownImageSongQuery, targetWidth, targetHeight);
@ -3042,7 +3045,7 @@ public class MultiPagePanel : Panel
/// <param name="e"></param>
private void ShouYeButton_Click(object sender, EventArgs e)
{
if(currentSongList == playedSongsHistory)
if(multiPagePanel.get_currentSongList() == playedSongsHistory)
return;
autoRefreshTimer.Stop(); // 停止自动刷新
/*

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 471 KiB

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 KiB

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 KiB

View File

@ -1,80 +0,0 @@
import cv2
import numpy as np
# 初始化坐标点
roi_pts = []
drawing = False # True if the mouse is pressed down
# 鼠标回调函数
def select_roi(event, x, y, flags, param):
global roi_pts, drawing
# 当按下左键是记录起始位置坐标
if event == cv2.EVENT_LBUTTONDOWN:
drawing = True
roi_pts = [(x, y)]
# 当鼠标左键按下并移动是绘制图形
elif event == cv2.EVENT_MOUSEMOVE:
if drawing == True:
temp_image = param.copy()
cv2.rectangle(temp_image, roi_pts[0], (x, y), (0, 255, 0), 2)
cv2.imshow('image', temp_image)
# 当松开鼠标左键停止绘画
elif event == cv2.EVENT_LBUTTONUP:
drawing = False
roi_pts.append((x, y))
cv2.rectangle(param, roi_pts[0], (x, y), (0, 255, 0), 2)
cv2.imshow('image', param)
# 读取图像
image = cv2.imread('555024.jpg')
image_copy = image.copy()
cv2.namedWindow('image')
cv2.setMouseCallback('image', select_roi, image)
# Keep looping until the 'q' key is pressed
while True:
cv2.imshow('image', image)
key = cv2.waitKey(1) & 0xFF
# 按下'r'重置选择区域
if key == ord('r'):
image = image_copy.copy()
roi_pts = []
# 按下'q'退出循环
elif key == ord('q'):
break
# 关闭所有打开的窗口
cv2.destroyAllWindows()
# 如果选择了区域,那么进行黄色检测
if len(roi_pts) == 2:
roi = image_copy[roi_pts[0][1]:roi_pts[1][1], roi_pts[0][0]:roi_pts[1][0]]
hsv_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV)
lower_yellow = np.array([20, 100, 100])
upper_yellow = np.array([30, 255, 255])
mask = cv2.inRange(hsv_roi, lower_yellow, upper_yellow)
# 在掩码上找出轮廓
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# 如果有轮廓则找出最大的轮廓
if contours:
max_contour = max(contours, key=cv2.contourArea)
x, y, w, h = cv2.boundingRect(max_contour)
cv2.rectangle(roi, (x, y), (x+w, y+h), (0, 255, 0), 2)
print(f"Yellow area at X: {x}, Y: {y}, W: {w}, H: {h}")
# 将边界框位置映射回原始图像
x += roi_pts[0][0]
y += roi_pts[0][1]
cv2.rectangle(image_copy, (x, y), (x+w, y+h), (0, 255, 0), 2)
print(f"Yellow area at X: {x}, Y: {y}, W: {w}, H: {h}")
cv2.imshow('Detected Yellow Area in ROI', image_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()

View File

@ -1,52 +0,0 @@
import cv2
import numpy as np
import os
# 使用絕對路徑
image_path = 'image.jpg'
# if not os.path.exists(image_path):
# print("File does not exist:", image_path)
# else:
# print("File exists, attempting to load...")
image = cv2.imread(image_path)
if image is None:
print("But failed to load.")
else:
print("Image loaded successfully, processing...")
# Convert to HSV color space
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
# Define the range for yellow color in HSV
# Adjust these ranges based on your specific yellow color and lighting conditions
lower_yellow = np.array([20, 100, 100])
upper_yellow = np.array([30, 255, 255])
lower_pink = np.array([140, 100, 100])
upper_pink = np.array([170, 255, 255])
lower_purple = np.array([129, 50, 50]) # Lower bound of purple
upper_purple = np.array([158, 255, 255]) # Upper bound of purple
lower_blue = np.array([110, 50, 50]) # Lower bound of blue
upper_blue = np.array([130, 255, 255]) # Upper bound of blue
lower_blue_violet = np.array([120, 50, 50]) # Lower bound of blue-violet
upper_blue_violet = np.array([160, 255, 255]) # Upper bound of blue-violet
# Create a mask for yellow color
mask = cv2.inRange(hsv, lower_pink, upper_pink)
# Find contours on the mask
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# Draw all contours
for contour in contours:
x, y, w, h = cv2.boundingRect(contour)
cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
coordinates_text = f"X: {x}, Y: {y}, W: {w}, H: {h}"
print(coordinates_text)
# Display coordinates on the image
cv2.putText(image, coordinates_text, (x, y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
# Show the image with all bounding boxes drawn
cv2.imshow('Image with yellow contours', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 379 KiB

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 KiB

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 186 KiB