kernel

Opencv入门基础笔记02

这一生的挚爱 提交于 2020-01-01 13:12:46
Opencv入门基础笔记02:矩阵的掩模操作 我们都知道,图片是由一个个像素点组成的,那么,我理解为一个巨大的矩阵,而矩阵掩模,就是,自己定义了一个特定的矩阵“kernel”或者叫“mask”,即掩模,然后,进行对矩阵的叉乘,是卷积滤波的一种体现,然后使图片呈现自己想要的样子。 实际上,掩膜mask是一种图像滤镜的模板,实用掩膜经常处理的是遥感图像。当提取道路或者河流,或者房屋时,通过一个n*n的矩阵来对图像进行像素过滤,然后将我们需要的地物或者标志突出显示出来。这个矩阵就是一种掩膜。在OpenCV中,掩模操作是相对简单的。大致的意思是,通过一个掩模矩阵,重新计算图像中的每一个像素值。掩模矩阵控制了旧图像当前位置以及周围位置像素对新图像当前位置像素值的影响力度。用数学术语讲,即我们自定义一个权重表。 1.用到的主要函数(filter2D,Mat,saturate_cast) 我们主要将掩模操作实现图片对比度的提高。用到的掩模为 Mat kern = (Mat_<char>(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0); 对应实际的数学计算公式为 I(i,j) = 5*I(i,j) - [I(i-1,j) + I(i+1,j) + I(i,j-1) + I(i,j+1)] 其中(i,j)是图片像素点坐标,I就是我们上面说的Kernel或者叫掩模mask

How does linux kernel creates sysfs?

不想你离开。 提交于 2020-01-01 11:48:23
问题 I have started looking at linux kernel code for my OS course. In that I'm interested in sys file system (sysfs). I'm interested in finding out when and how sysfs gets created? Which files in linux kernel code generate this file system? I have setup linux kernel on my system and have started debugging through the code. I have referred to this document to understand sysfs file system : [sysfs] : https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt But this document explains only about

Thread-local storage in kernel mode?

雨燕双飞 提交于 2020-01-01 04:43:09
问题 Is there a Thread-Local Storage (TLS) equivalent for kernel-mode drivers in Windows (Win32 to be exact)? What I try to achieve: Eventually from within my driver's dispatch routine it may call many other functions (there may be a deep callstack). I want to supply some context information specific to the request being processed. That is, I have some structure, pointer to which should be visible in all the called functions, without explicitly passing it as a parameter to every function. Using

Implementation of system calls / traps within Linux kernel source

落花浮王杯 提交于 2020-01-01 04:16:45
问题 I'm currently learning about operating systems the use of traps to facilitate system calls within the Linux kernel. I've located the table of the traps in traps.c and the implementation of many of the traps within entry.S. However, I'm instructed to find an implementation of two system calls in the Linux kernel which utilize traps to implement a system call. Although I can find the definition of the traps themselves, I'm not sure what a "call" to one of these traps within the kernel would

implicit declaration of function 'create_proc_entry'

狂风中的少年 提交于 2020-01-01 04:05:49
问题 I'm trying to use the create_proc_entry() function to create a directory under /proc. When I try to compile the code, I get the following error: implicit declaration of function 'create_proc_entry' . These are the headers I have included in my .c file: #include <linux/module.h> #include <linux/kernel.h> #include <linux/proc_fs.h> #include <linux/string.h> #include <linux/vmalloc.h> #include <linux/uaccess.h> The kernel version on the machine I'm trying to compile for is: 3.10.33-g7954807

How does a Windows Kernel mode Driver, access paged memory?

只愿长相守 提交于 2020-01-01 03:49:07
问题 1) A usermode process has its own "address context", which maps the user-mode virtual addresses to a unique collection of physical page frames. That is, the meaning of any particular virtual address changes from one moment to the next as the Windows XP scheduler switches threads. Part of work of "switching threads" is to change the page tables so that they refer to the incoming thread’s process context. _ 2) A Windows Kernel-mode Driver executes in "arbitrary thread context". A driver may

并发编程(IO多路复用)

被刻印的时光 ゝ 提交于 2019-12-31 23:29:37
转: https://www.cnblogs.com/cainingning/p/9556642.html 阅读目录 一 IO模型介绍 二 阻塞IO(blocking IO) 三 非阻塞IO(non-blocking IO) 四 多路复用IO(IO multiplexing) 五 异步IO(Asynchronous I/O) 六 IO模型比较分析 七 selectors模块 IO模型介绍   为了更好地了解IO模型,我们需要事先回顾下:同步、异步、阻塞、非阻塞 同步(synchronous) IO和异步(asynchronous) IO,阻塞(blocking) IO和非阻塞(non-blocking)IO分别是什么,到底有什么区别?这个问题其实不同的人给出的答案都可能不同,比如wiki,就认为asynchronous IO和non-blocking IO是一个东西。这其实是因为不同的人的知识背景不同,并且在讨论这个问题的时候上下文(context)也不相同。所以,为了更好的回答这个问题,我先限定一下本文的上下文。 本文讨论的背景是Linux环境下的network IO。本文最重要的参考文献是Richard Stevens的“UNIX® Network Programming Volume 1, Third Edition: The Sockets Networking ”,6

How were the weightings in the linux load computation chosen?

柔情痞子 提交于 2019-12-31 11:08:09
问题 In Linux, the load average is said to be on 1min/5min/15min. The formula used by the kernel is actually an Exponential moving average. If we define cpuload(1) as the first computation of the cpu load 1min, and active() as the function returning the number of process in state "running" or "runnable" on the system, then the formula used by the kernel to compute the nth cpu load 1min is: cpuload(0) is 0; it is the value stored in memory before the first execution of cpuload() . My question is,

How to use kernel libcrc32c (or same functions) in userspace programmes?

我是研究僧i 提交于 2019-12-31 10:02:11
问题 I want to do some CRC check in my own userspace programme. And I find that the kernel crypto lib is already in the system, and come with SSE4.2 support. I tried to directly #include <linux/crc32c.h> and run gcc with -I/usr/src/linux/include/ . However, it doesnot work. Any way to use some kind of libcrc32c ? 回答1: You can use kernel crypto CRC32c (and other hash/cipher functions) from user-space via socket family AF_ALG on Linux: #include <unistd.h> #include <stdio.h> #include <stdlib.h>

Linux kernel: Role of zero page allocation at paging_init time

余生长醉 提交于 2019-12-31 02:31:10
问题 I am trying to understand the kernel memory reservation at bootup for arch/arm. There's a call paging_init() for setting page tables, initialization of zone memory map etc in setup_arch() . It also allocate one zero page before allocating actual mem_map . void __init paging_init(const struct machine_desc *mdesc) { void *zero_page; --- zero_page = early_alloc(PAGE_SIZE); --- empty_zero_page = virt_to_page(zero_page); __flush_dcache_page(NULL, empty_zero_page); } Can someone please explain the