HuiHut

专业修电脑,副业补衣服。


  • 首页

  • 归档

  • 标签

  • 关于

  • 搜索

C# 解压压缩包及 7z 库缺失导致 Can not load 7-zip library or internal COM error!

发表于 2018-11-07 | 分类于 CS

表现

C# 程序解压 7z 文件的时候抛出异常

1
Can not load 7-zip library or internal COM error! Message: DLL file does not exist.
阅读全文 »

技嘉Z370 HD3P + i7-8700K + GTX1080 装黑苹果 High Sierra 10.13.6

发表于 2018-10-13 | 分类于 CS

前言

本博文记录了组装台式机装黑苹果 High Sierra 10.13.6 的经历。

原本想装 Mojave 10.14 的,可惜发现在 Mojave 下还没有 GTX1080 的驱动,所以只能退而求其次装 High Sierra 了。

装 High Sierra 的过程中,第一次使用 10.13.6(17G2112) 镜像遇到个问题(下文有描述),无法进入安装界面,因此后来使用 10.13.5(17F77) 镜像装好后在 AppStore 更新 10.13.6

阅读全文 »

pyparsing 无法卸载导致安装 matplotlib 出错

发表于 2018-10-13 | 分类于 CS

表现

1
sudo pip install matplotlib

安装 matplotlib 时出现以下错误

1
2
 Found existing installation: pyparsing 1.5.6
Cannot uninstall 'pyparsing'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
阅读全文 »

python-dev 库缺失导致安装 matplotlib 出错

发表于 2018-10-13 | 分类于 CS

表现

1
sudo pip install matplotlib

安装 matplotlib 时出现以下错误

阅读全文 »

WinRT(C++/CX) UTF8类型转换为std::string和Platform::String^的Unicode字符串

发表于 2018-08-23 | 分类于 CS

Gist 仓库地址:https://gist.github.com/huihut/8f75e2332e05673ff7e1248ad5e85339

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <string>
#include <Windows.h>

std::string UTF8_To_Std_Str(const std::string & str)
{
int nwLen = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0);

wchar_t* pwBuf = new wchar_t[nwLen + 1];
memset(pwBuf, 0, nwLen * 2 + 2);

MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), pwBuf, nwLen);

int nLen = WideCharToMultiByte(CP_ACP, 0, pwBuf, -1, NULL, NULL, NULL, NULL);

char* pBuf = new char[nLen + 1];
memset(pBuf, 0, nLen + 1);

WideCharToMultiByte(CP_ACP, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL);

std::string retStr = pBuf;

delete[] pBuf;
delete[] pwBuf;

pBuf = NULL;
pwBuf = NULL;

return retStr;
}

Platform::String^ UTF8_To_Managed_Str(const std::string & str)
{
int nwLen = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0);

wchar_t* pwBuf = new wchar_t[nwLen + 1];
memset(pwBuf, 0, nwLen * 2 + 2);

MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), pwBuf, nwLen);

Platform::String^ pStr = ref new Platform::String(pwBuf);

delete[] pwBuf;
pwBuf = NULL;

return pStr;
}

WinRT(C++/CX) Platform::String^ 与 std::string 的类型转换

发表于 2018-08-23 | 分类于 CS

Gist 仓库地址:https://gist.github.com/huihut/aa90bd3a202090e25b9a4792c80e6920

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>

std::string Managed_Str_To_Std_Str(Platform::String^ ms)
{
std::wstring w_str(ms->Begin());
return std::string(w_str.begin(), w_str.end());
}

Platform::String^ Std_Str_To_Managed_Str(const std::string & input)
{
std::wstring w_str = std::wstring(input.begin(), input.end());
const wchar_t* w_chars = w_str.c_str();
return (ref new Platform::String(w_chars));
}

OpenCV使用CMake和MinGW-w64的编译安装

发表于 2018-07-31 | 分类于 CS

前言

之前写过的一篇博文:OpenCV使用CMake和MinGW的编译安装及其在Qt配置运行 是使用 32 位的 MinGW 在 Windows 下编译 OpenCV 生成 32 位的 dll。

而这篇博文是使用 64 位的 MinGW 编译 OpenCV 生成 64 位的 dll。

因为博主没有 64 位 qmake,所以没勾选 WITH_QT

编译好的 OpenCV(MinGW 版):

Github . huihut/OpenCV-MinGW-Build

阅读全文 »

Linux 下 CLion 编写调用 C++ 共享库

发表于 2018-07-20 | 分类于 CS

编写 MySharedLib 共享库

创建一个名为 MySharedLib 的共享库

CMakeLists.txt

1
2
3
4
5
6
cmake_minimum_required(VERSION 3.10)
project(MySharedLib)

set(CMAKE_CXX_STANDARD 11)

add_library(MySharedLib SHARED library.cpp library.h)
阅读全文 »

UWP 动画改变控件大小(高度)

发表于 2018-07-18 | 分类于 CS

有这样一个需求:

  • 鼠标移动到(悬停在)控件上(PointerEntered),控件大小(高度)发生变化,以显示更多内容;
  • 鼠标移出控件(PointerExited),控件大小恢复原状。

本文通过 UWP 动画,用两种方法实现这个效果,用于改变周贡献榜和粉丝榜的 Grid 的高度。

阅读全文 »

Python 生成带标签数据集的 CSV 文件

发表于 2018-06-17 | 分类于 CS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# Python 生成 CSV 文件
# Python 生成 CSV 文件,可用于生成带标签的数据集 CSV 文件,标签从0开始自动升序:0,1,2,3...
# 作者:huihut
# 仓库:https://gist.github.com/huihut/9881c98a1d9279d4fa9dfd8475e3fe4b
# 参考:https://github.com/opencv/opencv_attic/blob/master/opencv/modules/contrib/doc/facerec/src/create_csv.py

'''

使用脚本:
* python create_csv.py <base_path> [save_path]
例如:
* python create_csv.py /Users/xx/code/dataset
* python create_csv.py /Users/xx/code/dataset ./dataset_csv.txt

目录结构(使用 tree 命令查看):
xx@xxs-MacBook-Pro:~/code/dataset$ tree
.
├── README
├── dataset_csv.txt
├── s01
│ ├── 01.pgm
│ ├── ...
│ └── 10.pgm
├── s02
│ ├── 01.pgm
│ ├── ...
│ └── 10.pgm
...
└── s10
├── 01.pgm
├── ...
└── 10.pgm

生成的 CSV 文件内容(使用 cat 命令查看 dataset_csv.txt 文件内容):
xx@xxs-MacBook-Pro:~/code/dataset$ cat dataset_csv.txt
/Users/xx/code/dataset/s01/01.pgm;0
/Users/xx/code/dataset/s01/02.pgm;0
...
/Users/xx/code/dataset/s01/10.pgm;0
/Users/xx/code/dataset/s02/01.pgm;1
/Users/xx/code/dataset/s02/02.pgm;1
...
/Users/xx/code/dataset/s10/01.pgm;9
/Users/xx/code/dataset/s10/02.pgm;9
...
/Users/xx/code/dataset/s10/10.pgm;9

'''

import sys
import os.path

if __name__ == "__main__":

SAVE_PATH = "./dataset_csv.txt"

if (len(sys.argv) != 2 and len(sys.argv) != 3):
print "usage:"
print "* python create_csv.py <base_path> [save_path]"
print "example:"
print "* python create_csv.py /Users/xx/code/dataset"
print "* python create_csv.py /Users/xx/code/dataset ./dataset_csv.txt"
sys.exit(1)
elif (len(sys.argv) == 3):
SAVE_PATH = sys.argv[2]

BASE_PATH = sys.argv[1]
SEPARATOR = ";"
fh = open(SAVE_PATH,'w')

label = 0
for dirname, dirnames, filenames in os.walk(BASE_PATH):
for subdirname in dirnames:
subject_path = os.path.join(dirname, subdirname)
for filename in os.listdir(subject_path):
abs_path = "%s/%s" % (subject_path, filename)
print "%s%s%d" % (abs_path, SEPARATOR, label)
fh.write(abs_path + SEPARATOR + str(label) + "\n")
label = label + 1
fh.close()
<123…6>

54 日志
1 分类
24 标签
RSS
GitHub CSDN 知乎 E-mail
© 2016 - 2024 huihut
由 Hexo 强力驱动
主题 - NexT.Muse